fix: event naming style in DalamudPluginInterface.cs (closes #458)

This commit is contained in:
goat 2021-08-23 08:30:23 +02:00
parent 84f516b11e
commit b1a596a598
No known key found for this signature in database
GPG key ID: F18F057873895461
4 changed files with 14 additions and 14 deletions

View file

@ -13,7 +13,7 @@ namespace Dalamud.Test
{ {
var workingDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var workingDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
this.localization = new Localization(workingDir, "dalamud_"); this.localization = new Localization(workingDir, "dalamud_");
this.localization.OnLocalizationChanged += code => this.currentLangCode = code; this.localization.LocalizationChanged += code => this.currentLangCode = code;
} }
[Fact] [Fact]

View file

@ -19,7 +19,7 @@ namespace Dalamud.Configuration.Internal
private string configPath; private string configPath;
/// <summary> /// <summary>
/// Delegate for the <see cref="OnDalamudConfigurationSaved"/> event that occurs when the dalamud configuration is saved. /// Delegate for the <see cref="DalamudConfiguration.DalamudConfigurationSaved"/> event that occurs when the dalamud configuration is saved.
/// </summary> /// </summary>
/// <param name="dalamudConfiguration">The current dalamud configuration.</param> /// <param name="dalamudConfiguration">The current dalamud configuration.</param>
public delegate void DalamudConfigurationSavedDelegate(DalamudConfiguration dalamudConfiguration); public delegate void DalamudConfigurationSavedDelegate(DalamudConfiguration dalamudConfiguration);
@ -27,7 +27,7 @@ namespace Dalamud.Configuration.Internal
/// <summary> /// <summary>
/// Event that occurs when dalamud configuration is saved. /// Event that occurs when dalamud configuration is saved.
/// </summary> /// </summary>
public event DalamudConfigurationSavedDelegate OnDalamudConfigurationSaved; public event DalamudConfigurationSavedDelegate DalamudConfigurationSaved;
/// <summary> /// <summary>
/// Gets or sets a list of muted works. /// Gets or sets a list of muted works.
@ -219,7 +219,7 @@ namespace Dalamud.Configuration.Internal
public void Save() public void Save()
{ {
File.WriteAllText(this.configPath, JsonConvert.SerializeObject(this, Formatting.Indented)); File.WriteAllText(this.configPath, JsonConvert.SerializeObject(this, Formatting.Indented));
this.OnDalamudConfigurationSaved?.Invoke(this); this.DalamudConfigurationSaved?.Invoke(this);
} }
} }
} }

View file

@ -41,7 +41,7 @@ namespace Dalamud
} }
/// <summary> /// <summary>
/// Delegate for the <see cref="OnLocalizationChanged"/> event that occurs when the language is changed. /// Delegate for the <see cref="Localization.LocalizationChanged"/> event that occurs when the language is changed.
/// </summary> /// </summary>
/// <param name="langCode">The language code of the new language.</param> /// <param name="langCode">The language code of the new language.</param>
public delegate void LocalizationChangedDelegate(string langCode); public delegate void LocalizationChangedDelegate(string langCode);
@ -49,7 +49,7 @@ namespace Dalamud
/// <summary> /// <summary>
/// Event that occurs when the language is changed. /// Event that occurs when the language is changed.
/// </summary> /// </summary>
public event LocalizationChangedDelegate OnLocalizationChanged; public event LocalizationChangedDelegate LocalizationChanged;
/// <summary> /// <summary>
/// Search the set-up localization data for the provided assembly for the given string key and return it. /// Search the set-up localization data for the provided assembly for the given string key and return it.
@ -95,7 +95,7 @@ namespace Dalamud
/// </summary> /// </summary>
public void SetupWithFallbacks() public void SetupWithFallbacks()
{ {
this.OnLocalizationChanged?.Invoke(FallbackLangCode); this.LocalizationChanged?.Invoke(FallbackLangCode);
Loc.SetupWithFallbacks(this.assembly); Loc.SetupWithFallbacks(this.assembly);
} }
@ -111,7 +111,7 @@ namespace Dalamud
return; return;
} }
this.OnLocalizationChanged?.Invoke(langCode); this.LocalizationChanged?.Invoke(langCode);
try try
{ {

View file

@ -60,8 +60,8 @@ namespace Dalamud.Plugin
this.UiLanguage = "en"; this.UiLanguage = "en";
} }
localization.OnLocalizationChanged += this.OnLocalizationChanged; localization.LocalizationChanged += this.OnLocalizationChanged;
configuration.OnDalamudConfigurationSaved += this.OnDalamudConfigurationSaved; configuration.DalamudConfigurationSaved += this.OnDalamudConfigurationSaved;
} }
/// <summary> /// <summary>
@ -73,7 +73,7 @@ namespace Dalamud.Plugin
/// <summary> /// <summary>
/// Event that gets fired when loc is changed /// Event that gets fired when loc is changed
/// </summary> /// </summary>
public event LanguageChangedDelegate OnLanguageChanged; public event LanguageChangedDelegate LanguageChanged;
/// <summary> /// <summary>
/// Gets the reason this plugin was loaded. /// Gets the reason this plugin was loaded.
@ -228,14 +228,14 @@ namespace Dalamud.Plugin
{ {
this.UiBuilder.Dispose(); this.UiBuilder.Dispose();
Service<ChatGui>.Get().RemoveChatLinkHandler(this.pluginName); Service<ChatGui>.Get().RemoveChatLinkHandler(this.pluginName);
Service<Localization>.Get().OnLocalizationChanged -= this.OnLocalizationChanged; Service<Localization>.Get().LocalizationChanged -= this.OnLocalizationChanged;
Service<DalamudConfiguration>.Get().OnDalamudConfigurationSaved -= this.OnDalamudConfigurationSaved; Service<DalamudConfiguration>.Get().DalamudConfigurationSaved -= this.OnDalamudConfigurationSaved;
} }
private void OnLocalizationChanged(string langCode) private void OnLocalizationChanged(string langCode)
{ {
this.UiLanguage = langCode; this.UiLanguage = langCode;
this.OnLanguageChanged?.Invoke(langCode); this.LanguageChanged?.Invoke(langCode);
} }
private void OnDalamudConfigurationSaved(DalamudConfiguration dalamudConfiguration) private void OnDalamudConfigurationSaved(DalamudConfiguration dalamudConfiguration)