using System; #if !DEBUG using System.Reflection; #endif using CustomizePlus.Api; using CustomizePlus.Core; using CustomizePlus.Core.Services; using CustomizePlus.UI; using Dalamud.Plugin; using ECommons; using OtterGui.Log; using OtterGui.Services; using Penumbra.GameData.Actors; namespace CustomizePlus; public sealed class Plugin : IDalamudPlugin { #if DEBUG public static readonly string Version = $"{ThisAssembly.Git.Commit}+{ThisAssembly.Git.Sha} [DEBUG]"; #else public static readonly string Version = Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? string.Empty; #endif private readonly ServiceManager _services; public static readonly Logger Logger = new(); //for loggin in static classes/methods public Plugin(IDalamudPluginInterface pluginInterface) { try { ECommonsMain.Init(pluginInterface, this); _services = ServiceManagerBuilder.CreateProvider(pluginInterface, Logger); _services.GetService(); //needs to be initialized early for config to be read properly _services.GetService(); _services.GetService(); _services.GetService(); Logger.Information($"Customize+ {Version} ({ThisAssembly.Git.Commit}+{ThisAssembly.Git.Sha}) [FantasiaPlus] started"); } catch (Exception ex) { Logger.Error($"Error instantiating plugin: {ex}"); Dispose(); throw; } } public void Dispose() { _services?.Dispose(); ECommonsMain.Dispose(); } }