Exemplo n.º 1
0
        /// <summary>
        /// Set up the interface and populate all fields needed.
        /// </summary>
        /// <param name="dalamud"></param>
        internal DalamudPluginInterface(Dalamud dalamud, string pluginName, PluginConfigurations configs, PluginLoadReason reason)
        {
            Reason = reason;
            this.CommandManager      = dalamud.CommandManager;
            this.Framework           = dalamud.Framework;
            this.ClientState         = dalamud.ClientState;
            this.UiBuilder           = new UiBuilder(dalamud, pluginName);
            this.TargetModuleScanner = dalamud.SigScanner;
            this.Data            = dalamud.Data;
            this.SeStringManager = dalamud.SeStringManager;

            this.dalamud    = dalamud;
            this.pluginName = pluginName;
            this.configs    = configs;
        }
Exemplo n.º 2
0
    /// <summary>
    /// Initializes a new instance of the <see cref="DalamudPluginInterface"/> class.
    /// Set up the interface and populate all fields needed.
    /// </summary>
    /// <param name="pluginName">The internal name of the plugin.</param>
    /// <param name="assemblyLocation">Location of the assembly.</param>
    /// <param name="reason">The reason the plugin was loaded.</param>
    /// <param name="isDev">A value indicating whether this is a dev plugin.</param>
    internal DalamudPluginInterface(string pluginName, FileInfo assemblyLocation, PluginLoadReason reason, bool isDev)
    {
        var configuration = Service <DalamudConfiguration> .Get();

        var dataManager = Service <DataManager> .Get();

        var localization = Service <Localization> .Get();

        this.UiBuilder = new UiBuilder(pluginName);

        this.pluginName       = pluginName;
        this.AssemblyLocation = assemblyLocation;
        this.configs          = Service <PluginManager> .Get().PluginConfigs;

        this.Reason = reason;
        this.IsDev  = isDev;

        this.LoadTime    = DateTime.Now;
        this.LoadTimeUTC = DateTime.UtcNow;

        this.GeneralChatType = configuration.GeneralChatType;
        this.Sanitizer       = new Sanitizer(dataManager.Language);
        if (configuration.LanguageOverride != null)
        {
            this.UiLanguage = configuration.LanguageOverride;
        }
        else
        {
            var currentUiLang = CultureInfo.CurrentUICulture;
            if (Localization.ApplicableLangCodes.Any(langCode => currentUiLang.TwoLetterISOLanguageName == langCode))
            {
                this.UiLanguage = currentUiLang.TwoLetterISOLanguageName;
            }
            else
            {
                this.UiLanguage = "en";
            }
        }

        localization.LocalizationChanged        += this.OnLocalizationChanged;
        configuration.DalamudConfigurationSaved += this.OnDalamudConfigurationSaved;
    }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DalamudPluginInterface"/> class.
        /// Set up the interface and populate all fields needed.
        /// </summary>
        /// <param name="dalamud">The dalamud instance to expose.</param>
        /// <param name="pluginName">The internal name of the plugin.</param>
        /// <param name="reason">The reason the plugin was loaded.</param>
        internal DalamudPluginInterface(Dalamud dalamud, string pluginName, PluginLoadReason reason)
        {
            this.CommandManager      = dalamud.CommandManager;
            this.Framework           = dalamud.Framework;
            this.ClientState         = dalamud.ClientState;
            this.UiBuilder           = new UiBuilder(dalamud, pluginName);
            this.TargetModuleScanner = dalamud.SigScanner;
            this.Data            = dalamud.Data;
            this.SeStringManager = dalamud.SeStringManager;

            this.dalamud    = dalamud;
            this.pluginName = pluginName;
            this.configs    = dalamud.PluginManager.PluginConfigs;
            this.Reason     = reason;

            this.GeneralChatType = this.dalamud.Configuration.GeneralChatType;
            this.Sanitizer       = new Sanitizer(this.Data.Language);
            if (this.dalamud.Configuration.LanguageOverride != null)
            {
                this.UiLanguage = this.dalamud.Configuration.LanguageOverride;
            }
            else
            {
                var currentUiLang = CultureInfo.CurrentUICulture;
                if (Localization.ApplicableLangCodes.Any(langCode => currentUiLang.TwoLetterISOLanguageName == langCode))
                {
                    this.UiLanguage = currentUiLang.TwoLetterISOLanguageName;
                }
                else
                {
                    this.UiLanguage = "en";
                }
            }

            dalamud.LocalizationManager.OnLocalizationChanged += this.OnLocalizationChanged;
            dalamud.Configuration.OnDalamudConfigurationSaved += this.OnDalamudConfigurationSaved;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DalamudPluginInterface"/> class.
        /// Set up the interface and populate all fields needed.
        /// </summary>
        /// <param name="dalamud">The dalamud instance to expose.</param>
        /// <param name="pluginName">The internal name of the plugin.</param>
        /// <param name="configs">The plugin configurations handler.</param>
        /// <param name="reason">The reason this plugin was loaded.</param>
        internal DalamudPluginInterface(Dalamud dalamud, string pluginName, PluginConfigurations configs, PluginLoadReason reason)
        {
            this.Reason              = reason;
            this.CommandManager      = dalamud.CommandManager;
            this.Framework           = dalamud.Framework;
            this.ClientState         = dalamud.ClientState;
            this.UiBuilder           = new UiBuilder(dalamud, pluginName);
            this.TargetModuleScanner = dalamud.SigScanner;
            this.Data            = dalamud.Data;
            this.SeStringManager = dalamud.SeStringManager;

            this.dalamud    = dalamud;
            this.pluginName = pluginName;
            this.configs    = configs;

            this.Sanitizer  = new Sanitizer(this.Data.Language);
            this.UiLanguage = this.dalamud.Configuration.LanguageOverride;
            dalamud.LocalizationManager.OnLocalizationChanged += this.OnLocalizationChanged;
        }