feat: pull strings into resources file

This commit is contained in:
Anna 2021-04-28 10:41:34 -04:00
parent c349ab4b07
commit d6045f3c33
6 changed files with 690 additions and 56 deletions

View File

@ -11,6 +11,10 @@
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\target.wav"/>
<EmbeddedResource Update="Resources\Language.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Language.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Reference Include="Dalamud">
@ -46,4 +50,11 @@
<PackageReference Include="Resourcer.Fody" Version="1.8.0" PrivateAssets="all"/>
<PackageReference Include="XivCommon" Version="1.2.0"/>
</ItemGroup>
<ItemGroup>
<Compile Update="Resources\Language.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Language.resx</DependentUpon>
</Compile>
</ItemGroup>
</Project>

View File

@ -10,6 +10,7 @@ using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Interface;
using PeepingTom.Resources;
namespace PeepingTom {
internal class PluginUi : IDisposable {
@ -34,7 +35,7 @@ namespace PeepingTom {
}
public PluginUi(PeepingTomPlugin plugin) {
this.Plugin = plugin ?? throw new ArgumentNullException(nameof(plugin), "PeepingTomPlugin cannot be null");
this.Plugin = plugin;
}
public void Dispose() {
@ -120,27 +121,28 @@ namespace PeepingTom {
private void ShowSettings() {
ImGui.SetNextWindowSize(new Vector2(700, 250));
if (!ImGui.Begin($"{this.Plugin.Name} settings", ref this._settingsOpen, ImGuiWindowFlags.NoResize)) {
var windowTitle = string.Format(Language.SettingsTitle, this.Plugin.Name);
if (!ImGui.Begin(windowTitle, ref this._settingsOpen, ImGuiWindowFlags.NoResize)) {
ImGui.End();
return;
}
if (ImGui.BeginTabBar("##settings-tabs")) {
if (ImGui.BeginTabItem("Markers")) {
if (ImGui.BeginTabItem(Language.SettingsMarkersTab)) {
var markTargeted = this.Plugin.Config.MarkTargeted;
if (ImGui.Checkbox("Mark your target", ref markTargeted)) {
if (ImGui.Checkbox(Language.SettingsMarkersMarkTarget, ref markTargeted)) {
this.Plugin.Config.MarkTargeted = markTargeted;
this.Plugin.Config.Save();
}
var targetedColour = this.Plugin.Config.TargetedColour;
if (ImGui.ColorEdit4("Target mark colour", ref targetedColour)) {
if (ImGui.ColorEdit4(Language.SettingsMarkersMarkTargetColour, ref targetedColour)) {
this.Plugin.Config.TargetedColour = targetedColour;
this.Plugin.Config.Save();
}
var targetedSize = this.Plugin.Config.TargetedSize;
if (ImGui.DragFloat("Target mark size", ref targetedSize, 0.01f, 0f, 15f)) {
if (ImGui.DragFloat(Language.SettingsMarkersMarkTargetSize, ref targetedSize, 0.01f, 0f, 15f)) {
targetedSize = Math.Max(0f, targetedSize);
this.Plugin.Config.TargetedSize = targetedSize;
this.Plugin.Config.Save();
@ -149,19 +151,19 @@ namespace PeepingTom {
ImGui.Spacing();
var markTargeting = this.Plugin.Config.MarkTargeting;
if (ImGui.Checkbox("Mark targeting you", ref markTargeting)) {
if (ImGui.Checkbox(Language.SettingsMarkersMarkTargeting, ref markTargeting)) {
this.Plugin.Config.MarkTargeting = markTargeting;
this.Plugin.Config.Save();
}
var targetingColour = this.Plugin.Config.TargetingColour;
if (ImGui.ColorEdit4("Targeting mark colour", ref targetingColour)) {
if (ImGui.ColorEdit4(Language.SettingsMarkersMarkTargetingColour, ref targetingColour)) {
this.Plugin.Config.TargetingColour = targetingColour;
this.Plugin.Config.Save();
}
var targetingSize = this.Plugin.Config.TargetingSize;
if (ImGui.DragFloat("Targeting mark size", ref targetingSize, 0.01f, 0f, 15f)) {
if (ImGui.DragFloat(Language.SettingsMarkersMarkTargetingSize, ref targetingSize, 0.01f, 0f, 15f)) {
targetingSize = Math.Max(0f, targetingSize);
this.Plugin.Config.TargetingSize = targetingSize;
this.Plugin.Config.Save();
@ -170,27 +172,27 @@ namespace PeepingTom {
ImGui.EndTabItem();
}
if (ImGui.BeginTabItem("Filters")) {
if (ImGui.BeginTabItem(Language.SettingsFilterTab)) {
var showParty = this.Plugin.Config.LogParty;
if (ImGui.Checkbox("Log party members", ref showParty)) {
if (ImGui.Checkbox(Language.SettingsFilterLogParty, ref showParty)) {
this.Plugin.Config.LogParty = showParty;
this.Plugin.Config.Save();
}
var logAlliance = this.Plugin.Config.LogAlliance;
if (ImGui.Checkbox("Log alliance members", ref logAlliance)) {
if (ImGui.Checkbox(Language.SettingsFilterLogAlliance, ref logAlliance)) {
this.Plugin.Config.LogAlliance = logAlliance;
this.Plugin.Config.Save();
}
var logInCombat = this.Plugin.Config.LogInCombat;
if (ImGui.Checkbox("Log targeters engaged in combat", ref logInCombat)) {
if (ImGui.Checkbox(Language.SettingsFilterLogCombat, ref logInCombat)) {
this.Plugin.Config.LogInCombat = logInCombat;
this.Plugin.Config.Save();
}
var logSelf = this.Plugin.Config.LogSelf;
if (ImGui.Checkbox("Log yourself", ref logSelf)) {
if (ImGui.Checkbox(Language.SettingsFilterLogSelf, ref logSelf)) {
this.Plugin.Config.LogSelf = logSelf;
this.Plugin.Config.Save();
}
@ -198,15 +200,15 @@ namespace PeepingTom {
ImGui.EndTabItem();
}
if (ImGui.BeginTabItem("Behaviour")) {
if (ImGui.BeginTabItem(Language.SettingsBehaviourTab)) {
var focusTarget = this.Plugin.Config.FocusTargetOnHover;
if (ImGui.Checkbox("Focus target on hover", ref focusTarget)) {
if (ImGui.Checkbox(Language.SettingsBehaviourFocusHover, ref focusTarget)) {
this.Plugin.Config.FocusTargetOnHover = focusTarget;
this.Plugin.Config.Save();
}
var openExamine = this.Plugin.Config.OpenExamine;
if (ImGui.Checkbox("Open examine window on Alt-click", ref openExamine)) {
if (ImGui.Checkbox(Language.SettingsBehaviourExamineEnabled, ref openExamine)) {
this.Plugin.Config.OpenExamine = openExamine;
this.Plugin.Config.Save();
}
@ -214,24 +216,24 @@ namespace PeepingTom {
ImGui.EndTabItem();
}
if (ImGui.BeginTabItem("Sound")) {
if (ImGui.BeginTabItem(Language.SettingsSoundTab)) {
var playSound = this.Plugin.Config.PlaySoundOnTarget;
if (ImGui.Checkbox("Play sound when targeted", ref playSound)) {
if (ImGui.Checkbox(Language.SettingsSoundEnabled, ref playSound)) {
this.Plugin.Config.PlaySoundOnTarget = playSound;
this.Plugin.Config.Save();
}
var path = this.Plugin.Config.SoundPath ?? "";
if (ImGui.InputText("Path to audio file", ref path, 1_000)) {
if (ImGui.InputText(Language.SettingsSoundPath, ref path, 1_000)) {
path = path.Trim();
this.Plugin.Config.SoundPath = path.Length == 0 ? null : path;
this.Plugin.Config.Save();
}
ImGui.Text("Leave this blank to use a built-in sound.");
ImGui.Text(Language.SettingsSoundPathHelp);
var volume = this.Plugin.Config.SoundVolume * 100f;
if (ImGui.DragFloat("Volume of sound", ref volume, .1f, 0f, 100f, "%.1f%%")) {
if (ImGui.DragFloat(Language.SettingsSoundVolume, ref volume, .1f, 0f, 100f, "%.1f%%")) {
this.Plugin.Config.SoundVolume = Math.Max(0f, Math.Min(1f, volume / 100f));
this.Plugin.Config.Save();
}
@ -239,16 +241,16 @@ namespace PeepingTom {
var soundDevice = this.Plugin.Config.SoundDevice;
string name;
if (soundDevice == -1) {
name = "Default";
name = Language.SettingsSoundDefaultDevice;
} else if (soundDevice > -1 && soundDevice < WaveOut.DeviceCount) {
var caps = WaveOut.GetCapabilities(soundDevice);
name = caps.ProductName;
} else {
name = "Invalid device";
name = Language.SettingsSoundInvalidDevice;
}
if (ImGui.BeginCombo("Output device", name)) {
if (ImGui.Selectable("Default")) {
if (ImGui.BeginCombo(Language.SettingsSoundOutputDevice, name)) {
if (ImGui.Selectable(Language.SettingsSoundDefaultDevice)) {
this.Plugin.Config.SoundDevice = -1;
this.Plugin.Config.Save();
}
@ -269,14 +271,14 @@ namespace PeepingTom {
}
var soundCooldown = this.Plugin.Config.SoundCooldown;
if (ImGui.DragFloat("Cooldown for sound (seconds)", ref soundCooldown, .01f, 0f, 30f)) {
if (ImGui.DragFloat(Language.SettingsSoundCooldown, ref soundCooldown, .01f, 0f, 30f)) {
soundCooldown = Math.Max(0f, soundCooldown);
this.Plugin.Config.SoundCooldown = soundCooldown;
this.Plugin.Config.Save();
}
var playWhenClosed = this.Plugin.Config.PlaySoundWhenClosed;
if (ImGui.Checkbox("Play sound when window is closed", ref playWhenClosed)) {
if (ImGui.Checkbox(Language.SettingsSoundPlayWhenClosed, ref playWhenClosed)) {
this.Plugin.Config.PlaySoundWhenClosed = playWhenClosed;
this.Plugin.Config.Save();
}
@ -284,21 +286,21 @@ namespace PeepingTom {
ImGui.EndTabItem();
}
if (ImGui.BeginTabItem("Window")) {
if (ImGui.BeginTabItem(Language.SettingsWindowTab)) {
var openOnLogin = this.Plugin.Config.OpenOnLogin;
if (ImGui.Checkbox("Open on login", ref openOnLogin)) {
if (ImGui.Checkbox(Language.SettingsWindowOpenLogin, ref openOnLogin)) {
this.Plugin.Config.OpenOnLogin = openOnLogin;
this.Plugin.Config.Save();
}
var allowMovement = this.Plugin.Config.AllowMovement;
if (ImGui.Checkbox("Allow moving the main window", ref allowMovement)) {
if (ImGui.Checkbox(Language.SettingsWindowAllowMovement, ref allowMovement)) {
this.Plugin.Config.AllowMovement = allowMovement;
this.Plugin.Config.Save();
}
var allowResizing = this.Plugin.Config.AllowResize;
if (ImGui.Checkbox("Allow resizing the main window", ref allowResizing)) {
if (ImGui.Checkbox(Language.SettingsWindowAllowResize, ref allowResizing)) {
this.Plugin.Config.AllowResize = allowResizing;
this.Plugin.Config.Save();
}
@ -306,19 +308,19 @@ namespace PeepingTom {
ImGui.Spacing();
var showInCombat = this.Plugin.Config.ShowInCombat;
if (ImGui.Checkbox("Show window while in combat", ref showInCombat)) {
if (ImGui.Checkbox(Language.SettingsWindowShowCombat, ref showInCombat)) {
this.Plugin.Config.ShowInCombat = showInCombat;
this.Plugin.Config.Save();
}
var showInInstance = this.Plugin.Config.ShowInInstance;
if (ImGui.Checkbox("Show window while in instance", ref showInInstance)) {
if (ImGui.Checkbox(Language.SettingsWindowShowInstance, ref showInInstance)) {
this.Plugin.Config.ShowInInstance = showInInstance;
this.Plugin.Config.Save();
}
var showInCutscenes = this.Plugin.Config.ShowInCutscenes;
if (ImGui.Checkbox("Show window while in cutscenes", ref showInCutscenes)) {
if (ImGui.Checkbox(Language.SettingsWindowShowCutscene, ref showInCutscenes)) {
this.Plugin.Config.ShowInCutscenes = showInCutscenes;
this.Plugin.Config.Save();
}
@ -326,28 +328,28 @@ namespace PeepingTom {
ImGui.EndTabItem();
}
if (ImGui.BeginTabItem("History")) {
if (ImGui.BeginTabItem(Language.SettingsHistoryTab)) {
var keepHistory = this.Plugin.Config.KeepHistory;
if (ImGui.Checkbox("Show previous targeters", ref keepHistory)) {
if (ImGui.Checkbox(Language.SettingsHistoryEnabled, ref keepHistory)) {
this.Plugin.Config.KeepHistory = keepHistory;
this.Plugin.Config.Save();
}
var historyWhenClosed = this.Plugin.Config.HistoryWhenClosed;
if (ImGui.Checkbox("Record history when window is closed", ref historyWhenClosed)) {
if (ImGui.Checkbox(Language.SettingsHistoryRecordClosed, ref historyWhenClosed)) {
this.Plugin.Config.HistoryWhenClosed = historyWhenClosed;
this.Plugin.Config.Save();
}
var numHistory = this.Plugin.Config.NumHistory;
if (ImGui.InputInt("Number of previous targeters to keep", ref numHistory)) {
if (ImGui.InputInt(Language.SettingsHistoryAmount, ref numHistory)) {
numHistory = Math.Max(0, Math.Min(50, numHistory));
this.Plugin.Config.NumHistory = numHistory;
this.Plugin.Config.Save();
}
var showTimestamps = this.Plugin.Config.ShowTimestamps;
if (ImGui.Checkbox("Show timestamps", ref showTimestamps)) {
if (ImGui.Checkbox(Language.SettingsHistoryTimestamps, ref showTimestamps)) {
this.Plugin.Config.ShowTimestamps = showTimestamps;
this.Plugin.Config.Save();
}
@ -355,9 +357,9 @@ namespace PeepingTom {
ImGui.EndTabItem();
}
if (ImGui.BeginTabItem("Advanced")) {
if (ImGui.BeginTabItem(Language.SettingsAdvancedTab)) {
var pollFrequency = this.Plugin.Config.PollFrequency;
if (ImGui.DragInt("Poll frequency in milliseconds", ref pollFrequency, .1f, 1, 1600)) {
if (ImGui.DragInt(Language.SettingsAdvancedPollFrequency, ref pollFrequency, .1f, 1, 1600)) {
this.Plugin.Config.PollFrequency = pollFrequency;
this.Plugin.Config.Save();
}
@ -365,6 +367,7 @@ namespace PeepingTom {
ImGui.EndTabItem();
}
#if DEBUG
if (ImGui.BeginTabItem("Debug")) {
if (ImGui.Button("Log targeting you")) {
var player = this.Plugin.Interface.ClientState.LocalPlayer;
@ -397,6 +400,7 @@ namespace PeepingTom {
ImGui.EndTabItem();
}
#endif
ImGui.EndTabBar();
}
@ -440,9 +444,11 @@ namespace PeepingTom {
}
{
ImGui.Text("Targeting you");
ImGui.Text(Language.MainTargetingYou);
ImGui.SameLine();
HelpMarker(this.Plugin.Config.OpenExamine ? "Click to link, Alt-click to examine, or right click to target." : "Click to link or right click to target.");
HelpMarker(this.Plugin.Config.OpenExamine
? Language.MainHelpExamine
: Language.MainHelpNoExamine);
var height = ImGui.GetContentRegionAvail().Y;
height -= ImGui.GetStyle().ItemSpacing.Y;
@ -558,10 +564,7 @@ namespace PeepingTom {
if (actor != null) {
this.Plugin.Common.Functions.Examine.OpenExamineWindow(actor);
} else {
var error = new SeString(new Payload[] {
new PlayerPayload(this.Plugin.Interface.Data, targeter.Name, targeter.HomeWorld.Id),
new TextPayload(" is not close enough to examine."),
});
var error = string.Format(Language.ExamineErrorToast, targeter.Name);
this.Plugin.Interface.Framework.Gui.Toast.ShowError(error);
}
} else {

468
Peeping Tom/Resources/Language.Designer.cs generated Executable file
View File

@ -0,0 +1,468 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PeepingTom.Resources {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Language {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Language() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PeepingTom.Resources.Language", typeof(Language).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to {0} is not close enough to examine..
/// </summary>
internal static string ExamineErrorToast {
get {
return ResourceManager.GetString("ExamineErrorToast", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Click to link, Alt-click to examine, or right click to target..
/// </summary>
internal static string MainHelpExamine {
get {
return ResourceManager.GetString("MainHelpExamine", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Click to link or right click to target..
/// </summary>
internal static string MainHelpNoExamine {
get {
return ResourceManager.GetString("MainHelpNoExamine", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Targeting you.
/// </summary>
internal static string MainTargetingYou {
get {
return ResourceManager.GetString("MainTargetingYou", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Poll frequency in milliseconds.
/// </summary>
internal static string SettingsAdvancedPollFrequency {
get {
return ResourceManager.GetString("SettingsAdvancedPollFrequency", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Advanced.
/// </summary>
internal static string SettingsAdvancedTab {
get {
return ResourceManager.GetString("SettingsAdvancedTab", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Open examine window on Alt-click.
/// </summary>
internal static string SettingsBehaviourExamineEnabled {
get {
return ResourceManager.GetString("SettingsBehaviourExamineEnabled", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Focus target on hover.
/// </summary>
internal static string SettingsBehaviourFocusHover {
get {
return ResourceManager.GetString("SettingsBehaviourFocusHover", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Behaviour.
/// </summary>
internal static string SettingsBehaviourTab {
get {
return ResourceManager.GetString("SettingsBehaviourTab", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Log alliance members.
/// </summary>
internal static string SettingsFilterLogAlliance {
get {
return ResourceManager.GetString("SettingsFilterLogAlliance", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Log targeters engaged in combat.
/// </summary>
internal static string SettingsFilterLogCombat {
get {
return ResourceManager.GetString("SettingsFilterLogCombat", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Log party members.
/// </summary>
internal static string SettingsFilterLogParty {
get {
return ResourceManager.GetString("SettingsFilterLogParty", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Log yourself.
/// </summary>
internal static string SettingsFilterLogSelf {
get {
return ResourceManager.GetString("SettingsFilterLogSelf", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Filters.
/// </summary>
internal static string SettingsFilterTab {
get {
return ResourceManager.GetString("SettingsFilterTab", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Number of previous targeters to keep.
/// </summary>
internal static string SettingsHistoryAmount {
get {
return ResourceManager.GetString("SettingsHistoryAmount", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show previous targeters.
/// </summary>
internal static string SettingsHistoryEnabled {
get {
return ResourceManager.GetString("SettingsHistoryEnabled", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Record history when window is closed.
/// </summary>
internal static string SettingsHistoryRecordClosed {
get {
return ResourceManager.GetString("SettingsHistoryRecordClosed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to History.
/// </summary>
internal static string SettingsHistoryTab {
get {
return ResourceManager.GetString("SettingsHistoryTab", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show timestamps.
/// </summary>
internal static string SettingsHistoryTimestamps {
get {
return ResourceManager.GetString("SettingsHistoryTimestamps", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Mark your target.
/// </summary>
internal static string SettingsMarkersMarkTarget {
get {
return ResourceManager.GetString("SettingsMarkersMarkTarget", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Target mark colour.
/// </summary>
internal static string SettingsMarkersMarkTargetColour {
get {
return ResourceManager.GetString("SettingsMarkersMarkTargetColour", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Mark targeting you.
/// </summary>
internal static string SettingsMarkersMarkTargeting {
get {
return ResourceManager.GetString("SettingsMarkersMarkTargeting", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Targeting mark colour.
/// </summary>
internal static string SettingsMarkersMarkTargetingColour {
get {
return ResourceManager.GetString("SettingsMarkersMarkTargetingColour", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Targeting mark size.
/// </summary>
internal static string SettingsMarkersMarkTargetingSize {
get {
return ResourceManager.GetString("SettingsMarkersMarkTargetingSize", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Target mark size.
/// </summary>
internal static string SettingsMarkersMarkTargetSize {
get {
return ResourceManager.GetString("SettingsMarkersMarkTargetSize", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Markers.
/// </summary>
internal static string SettingsMarkersTab {
get {
return ResourceManager.GetString("SettingsMarkersTab", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cooldown for sound (seconds).
/// </summary>
internal static string SettingsSoundCooldown {
get {
return ResourceManager.GetString("SettingsSoundCooldown", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Default.
/// </summary>
internal static string SettingsSoundDefaultDevice {
get {
return ResourceManager.GetString("SettingsSoundDefaultDevice", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Play sound when targeted.
/// </summary>
internal static string SettingsSoundEnabled {
get {
return ResourceManager.GetString("SettingsSoundEnabled", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Invalid device.
/// </summary>
internal static string SettingsSoundInvalidDevice {
get {
return ResourceManager.GetString("SettingsSoundInvalidDevice", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Output device.
/// </summary>
internal static string SettingsSoundOutputDevice {
get {
return ResourceManager.GetString("SettingsSoundOutputDevice", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Path to audio file.
/// </summary>
internal static string SettingsSoundPath {
get {
return ResourceManager.GetString("SettingsSoundPath", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Leave this blank to use a built-in sound..
/// </summary>
internal static string SettingsSoundPathHelp {
get {
return ResourceManager.GetString("SettingsSoundPathHelp", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Play sound when window is closed.
/// </summary>
internal static string SettingsSoundPlayWhenClosed {
get {
return ResourceManager.GetString("SettingsSoundPlayWhenClosed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sound.
/// </summary>
internal static string SettingsSoundTab {
get {
return ResourceManager.GetString("SettingsSoundTab", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Volume of sound.
/// </summary>
internal static string SettingsSoundVolume {
get {
return ResourceManager.GetString("SettingsSoundVolume", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} settings.
/// </summary>
internal static string SettingsTitle {
get {
return ResourceManager.GetString("SettingsTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Allow moving the main window.
/// </summary>
internal static string SettingsWindowAllowMovement {
get {
return ResourceManager.GetString("SettingsWindowAllowMovement", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Allow resizing the main window.
/// </summary>
internal static string SettingsWindowAllowResize {
get {
return ResourceManager.GetString("SettingsWindowAllowResize", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Open on login.
/// </summary>
internal static string SettingsWindowOpenLogin {
get {
return ResourceManager.GetString("SettingsWindowOpenLogin", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show window while in combat.
/// </summary>
internal static string SettingsWindowShowCombat {
get {
return ResourceManager.GetString("SettingsWindowShowCombat", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show window while in cutscenes.
/// </summary>
internal static string SettingsWindowShowCutscene {
get {
return ResourceManager.GetString("SettingsWindowShowCutscene", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show window while in instance.
/// </summary>
internal static string SettingsWindowShowInstance {
get {
return ResourceManager.GetString("SettingsWindowShowInstance", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Window.
/// </summary>
internal static string SettingsWindowTab {
get {
return ResourceManager.GetString("SettingsWindowTab", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Could not play sound file: {0}.
/// </summary>
internal static string SoundChatError {
get {
return ResourceManager.GetString("SoundChatError", resourceCulture);
}
}
}
}

View File

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="SettingsTitle" xml:space="preserve">
<value>{0} settings</value>
</data>
<data name="SettingsMarkersTab" xml:space="preserve">
<value>Markers</value>
</data>
<data name="SettingsMarkersMarkTarget" xml:space="preserve">
<value>Mark your target</value>
</data>
<data name="SettingsMarkersMarkTargetColour" xml:space="preserve">
<value>Target mark colour</value>
</data>
<data name="SettingsMarkersMarkTargetSize" xml:space="preserve">
<value>Target mark size</value>
</data>
<data name="SettingsMarkersMarkTargeting" xml:space="preserve">
<value>Mark targeting you</value>
</data>
<data name="SettingsMarkersMarkTargetingColour" xml:space="preserve">
<value>Targeting mark colour</value>
</data>
<data name="SettingsMarkersMarkTargetingSize" xml:space="preserve">
<value>Targeting mark size</value>
</data>
<data name="SettingsFilterTab" xml:space="preserve">
<value>Filters</value>
</data>
<data name="SettingsFilterLogParty" xml:space="preserve">
<value>Log party members</value>
</data>
<data name="SettingsFilterLogAlliance" xml:space="preserve">
<value>Log alliance members</value>
</data>
<data name="SettingsFilterLogCombat" xml:space="preserve">
<value>Log targeters engaged in combat</value>
</data>
<data name="SettingsFilterLogSelf" xml:space="preserve">
<value>Log yourself</value>
</data>
<data name="SettingsBehaviourTab" xml:space="preserve">
<value>Behaviour</value>
</data>
<data name="SettingsBehaviourFocusHover" xml:space="preserve">
<value>Focus target on hover</value>
</data>
<data name="SettingsBehaviourExamineEnabled" xml:space="preserve">
<value>Open examine window on Alt-click</value>
</data>
<data name="SettingsSoundTab" xml:space="preserve">
<value>Sound</value>
</data>
<data name="SettingsSoundEnabled" xml:space="preserve">
<value>Play sound when targeted</value>
</data>
<data name="SettingsSoundPath" xml:space="preserve">
<value>Path to audio file</value>
</data>
<data name="SettingsSoundPathHelp" xml:space="preserve">
<value>Leave this blank to use a built-in sound.</value>
</data>
<data name="SettingsSoundVolume" xml:space="preserve">
<value>Volume of sound</value>
</data>
<data name="SettingsSoundDefaultDevice" xml:space="preserve">
<value>Default</value>
</data>
<data name="SettingsSoundInvalidDevice" xml:space="preserve">
<value>Invalid device</value>
</data>
<data name="SettingsSoundOutputDevice" xml:space="preserve">
<value>Output device</value>
</data>
<data name="SettingsSoundCooldown" xml:space="preserve">
<value>Cooldown for sound (seconds)</value>
</data>
<data name="SettingsSoundPlayWhenClosed" xml:space="preserve">
<value>Play sound when window is closed</value>
</data>
<data name="SettingsWindowTab" xml:space="preserve">
<value>Window</value>
</data>
<data name="SettingsWindowOpenLogin" xml:space="preserve">
<value>Open on login</value>
</data>
<data name="SettingsWindowAllowMovement" xml:space="preserve">
<value>Allow moving the main window</value>
</data>
<data name="SettingsWindowAllowResize" xml:space="preserve">
<value>Allow resizing the main window</value>
</data>
<data name="SettingsWindowShowCombat" xml:space="preserve">
<value>Show window while in combat</value>
</data>
<data name="SettingsWindowShowInstance" xml:space="preserve">
<value>Show window while in instance</value>
</data>
<data name="SettingsWindowShowCutscene" xml:space="preserve">
<value>Show window while in cutscenes</value>
</data>
<data name="SettingsHistoryTab" xml:space="preserve">
<value>History</value>
</data>
<data name="SettingsHistoryEnabled" xml:space="preserve">
<value>Show previous targeters</value>
</data>
<data name="SettingsHistoryRecordClosed" xml:space="preserve">
<value>Record history when window is closed</value>
</data>
<data name="SettingsHistoryAmount" xml:space="preserve">
<value>Number of previous targeters to keep</value>
</data>
<data name="SettingsHistoryTimestamps" xml:space="preserve">
<value>Show timestamps</value>
</data>
<data name="SettingsAdvancedTab" xml:space="preserve">
<value>Advanced</value>
</data>
<data name="SettingsAdvancedPollFrequency" xml:space="preserve">
<value>Poll frequency in milliseconds</value>
</data>
<data name="ExamineErrorToast" xml:space="preserve">
<value>{0} is not close enough to examine.</value>
</data>
<data name="MainTargetingYou" xml:space="preserve">
<value>Targeting you</value>
</data>
<data name="MainHelpExamine" xml:space="preserve">
<value>Click to link, Alt-click to examine, or right click to target.</value>
</data>
<data name="MainHelpNoExamine" xml:space="preserve">
<value>Click to link or right click to target.</value>
</data>
<data name="SoundChatError" xml:space="preserve">
<value>Could not play sound file: {0}</value>
</data>
</root>

View File

@ -12,6 +12,7 @@ using System.Threading;
using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
using PeepingTom.Resources;
namespace PeepingTom {
internal class TargetWatcher : IDisposable {
@ -52,7 +53,7 @@ namespace PeepingTom {
}
public TargetWatcher(PeepingTomPlugin plugin) {
this.Plugin = plugin ?? throw new ArgumentNullException(nameof(plugin), "PeepingTomPlugin cannot be null");
this.Plugin = plugin;
}
public void ClearPrevious() {
@ -202,7 +203,8 @@ namespace PeepingTom {
reader = new AudioFileReader(this.Plugin.Config.SoundPath);
}
} catch (Exception e) {
this.SendError($"Could not play sound file: {e.Message}");
var error = string.Format(Language.SoundChatError, e.Message);
this.SendError(error);
return;
}

View File

@ -12,9 +12,6 @@ namespace PeepingTom {
public DateTime When { get; }
public Targeter(PlayerCharacter character) {
if (character == null) {
throw new ArgumentNullException(nameof(character), "PlayerCharacter cannot be null");
}
this.Name = character.Name;
this.HomeWorld = character.HomeWorld;
this.ActorId = character.ActorId;
@ -22,9 +19,6 @@ namespace PeepingTom {
}
public PlayerCharacter? GetPlayerCharacter(DalamudPluginInterface pi) {
if (pi == null) {
throw new ArgumentNullException(nameof(pi), "DalamudPluginInterface cannot be null");
}
return pi.ClientState.Actors.FirstOrDefault(actor => actor.ActorId == this.ActorId && actor is PlayerCharacter) as PlayerCharacter;
}
}