mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 21:24:16 +01:00
Merge branch 'master' of https://github.com/goatcorp/Dalamud
This commit is contained in:
commit
764f9614ab
9 changed files with 40 additions and 13 deletions
|
|
@ -143,7 +143,7 @@ namespace Dalamud
|
|||
Service<NetworkHandlers>.Set();
|
||||
Log.Information("[T2] NH OK!");
|
||||
|
||||
Service<ClientState>.Set();
|
||||
var clientState = Service<ClientState>.Set();
|
||||
Log.Information("[T2] CS OK!");
|
||||
|
||||
var localization = Service<Localization>.Set(new Localization(Path.Combine(this.AssetDirectory.FullName, "UIRes", "loc", "dalamud"), "dalamud_"));
|
||||
|
|
@ -210,7 +210,7 @@ namespace Dalamud
|
|||
|
||||
Log.Information("[T2] CH OK!");
|
||||
|
||||
Service<ClientState>.Set().Enable();
|
||||
clientState.Enable();
|
||||
Log.Information("[T2] CS ENABLE!");
|
||||
|
||||
Service<DalamudSystemMenu>.Set().Enable();
|
||||
|
|
|
|||
|
|
@ -88,6 +88,11 @@ namespace Dalamud.Game.ClientState.Objects.Types
|
|||
/// </summary>
|
||||
public override uint TargetObjectId => this.Struct->GameObject.TargetObjectID;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name ID of the character.
|
||||
/// </summary>
|
||||
public uint NameId => this.Struct->NameID;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the status flags.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ namespace Dalamud.Game.ClientState.Objects.Types
|
|||
/// <summary>
|
||||
/// Gets the name of this <see cref="GameObject" />.
|
||||
/// </summary>
|
||||
public SeString Name => MemoryHelper.ReadSeString((IntPtr)this.Struct->Name, 32);
|
||||
public SeString Name => MemoryHelper.ReadSeString((IntPtr)this.Struct->Name, 64);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the object ID of this <see cref="GameObject" />.
|
||||
|
|
|
|||
|
|
@ -107,7 +107,6 @@ namespace Dalamud.Game.Gui.FlyText
|
|||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
this.createFlyTextHook.Disable();
|
||||
this.createFlyTextHook.Dispose();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ namespace Dalamud.Hooking
|
|||
{
|
||||
if (this.IsDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("Hook is already disposed.");
|
||||
throw new ObjectDisposedException(message: "Hook is already disposed", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace Dalamud.IoC.Internal
|
|||
return (parameterType, requiredVersion);
|
||||
});
|
||||
|
||||
var versionCheck = parameters.Any(p =>
|
||||
var versionCheck = parameters.All(p =>
|
||||
{
|
||||
// if there's no required version, ignore it
|
||||
if (p.requiredVersion == null)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
|
@ -123,6 +124,16 @@ namespace Dalamud.Plugin
|
|||
/// </summary>
|
||||
public XivChatType GeneralChatType { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of installed plugin names.
|
||||
/// </summary>
|
||||
public List<string> PluginNames => Service<PluginManager>.Get().InstalledPlugins.Select(p => p.Manifest.Name).ToList();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of installed plugin internal names.
|
||||
/// </summary>
|
||||
public List<string> PluginInternalNames => Service<PluginManager>.Get().InstalledPlugins.Select(p => p.Manifest.InternalName).ToList();
|
||||
|
||||
#region Configuration
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -210,7 +221,8 @@ namespace Dalamud.Plugin
|
|||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Unregister your plugin and dispose all references. You have to call this when your IDalamudPlugin is disposed.
|
||||
/// Unregister your plugin and dispose all references.
|
||||
/// You have to call this when your IDalamudPlugin is disposed.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -55,11 +55,6 @@ namespace Dalamud.Plugin.Internal
|
|||
{
|
||||
// BadImageFormatException
|
||||
this.pluginAssembly = this.loader.LoadDefaultAssembly();
|
||||
|
||||
// InvalidOperationException
|
||||
this.pluginType = this.pluginAssembly.GetTypes().First(type => type.IsAssignableTo(typeof(IDalamudPlugin)));
|
||||
|
||||
assemblyVersion = this.pluginAssembly.GetName().Version;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -67,10 +62,23 @@ namespace Dalamud.Plugin.Internal
|
|||
this.pluginType = null;
|
||||
this.loader.Dispose();
|
||||
|
||||
Log.Error(ex, $"Not a plugin: {this.DllFile.Name}");
|
||||
Log.Error(ex, $"Not a plugin: {this.DllFile.FullName}");
|
||||
throw new InvalidPluginException(this.DllFile);
|
||||
}
|
||||
|
||||
this.pluginType = this.pluginAssembly.GetTypes().FirstOrDefault(type => type.IsAssignableTo(typeof(IDalamudPlugin)));
|
||||
if (this.pluginType == default)
|
||||
{
|
||||
this.pluginAssembly = null;
|
||||
this.pluginType = null;
|
||||
this.loader.Dispose();
|
||||
|
||||
Log.Error($"Nothing inherits from IDalamudPlugin: {this.DllFile.FullName}");
|
||||
throw new InvalidPluginException(this.DllFile);
|
||||
}
|
||||
|
||||
assemblyVersion = this.pluginAssembly.GetName().Version;
|
||||
|
||||
// Files that may or may not exist
|
||||
this.manifestFile = LocalPluginManifest.GetManifestFile(this.DllFile);
|
||||
this.disabledFile = LocalPluginManifest.GetDisabledFile(this.DllFile);
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ namespace Dalamud
|
|||
/// <returns>The set object.</returns>
|
||||
public static T Set()
|
||||
{
|
||||
if (instance != null)
|
||||
throw new Exception($"Service {typeof(T).FullName} was set twice");
|
||||
|
||||
var obj = (T?)Activator.CreateInstance(typeof(T), true);
|
||||
|
||||
SetInstanceObject(obj);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue