diff --git a/PlayerTags/MyPaths.cs b/PlayerTags/MyPaths.cs
new file mode 100644
index 0000000..b5b88a1
--- /dev/null
+++ b/PlayerTags/MyPaths.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlayerTags
+{
+ internal class MyPaths
+ {
+ private static string? _PluginDirectoryPath = null;
+
+ public static string PluginDirectoryPath
+ {
+ get
+ {
+ if (_PluginDirectoryPath is null)
+ {
+ var path = Path.GetDirectoryName(PluginServices.DalamudPluginInterface.AssemblyLocation.FullName);
+ if (path is null)
+ _PluginDirectoryPath = string.Empty;
+ else
+ _PluginDirectoryPath = path;
+ }
+ return _PluginDirectoryPath;
+ }
+ }
+
+ public static string ResourcePath
+ => Path.Combine(PluginDirectoryPath, "Resources");
+ }
+}
diff --git a/PlayerTags/PlayerTags.csproj b/PlayerTags/PlayerTags.csproj
index fb3f3b2..b543362 100644
--- a/PlayerTags/PlayerTags.csproj
+++ b/PlayerTags/PlayerTags.csproj
@@ -53,6 +53,11 @@
+
+ True
+ True
+ Paths.resx
+
True
True
@@ -61,6 +66,10 @@
+
+ ResXFileCodeGenerator
+ Paths.Designer.cs
+
PublicResXFileCodeGenerator
Strings.Designer.cs
diff --git a/PlayerTags/RandomNameGenerator.cs b/PlayerTags/RandomNameGenerator.cs
index 384548d..54bebfb 100644
--- a/PlayerTags/RandomNameGenerator.cs
+++ b/PlayerTags/RandomNameGenerator.cs
@@ -11,12 +11,6 @@ namespace PlayerTags
///
public static class RandomNameGenerator
{
- private static string? PluginDirectory
- {
- get { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); }
- }
-
- private const string c_AdjectivesPath = "Resources/Words/Adjectives.txt";
private static string[]? s_Adjectives;
private static string[] Adjectives
{
@@ -26,7 +20,7 @@ namespace PlayerTags
{
try
{
- s_Adjectives = File.ReadAllLines($"{PluginDirectory}/{c_AdjectivesPath}");
+ s_Adjectives = File.ReadAllLines(Path.Combine(MyPaths.ResourcePath, Resources.Paths.AdjectivesTxt));
}
catch (Exception ex)
{
@@ -43,7 +37,6 @@ namespace PlayerTags
}
}
- private const string c_NounsPath = "Resources/Words/Nouns.txt";
private static string[]? s_Nouns;
private static string[] Nouns
{
@@ -53,7 +46,7 @@ namespace PlayerTags
{
try
{
- s_Nouns = File.ReadAllLines($"{PluginDirectory}/{c_NounsPath}");
+ s_Nouns = File.ReadAllLines(Path.Combine(MyPaths.ResourcePath, Resources.Paths.NounsTxt));
}
catch (Exception ex)
{
diff --git a/PlayerTags/Resources/Paths.Designer.cs b/PlayerTags/Resources/Paths.Designer.cs
new file mode 100644
index 0000000..d9d57ae
--- /dev/null
+++ b/PlayerTags/Resources/Paths.Designer.cs
@@ -0,0 +1,81 @@
+//------------------------------------------------------------------------------
+//
+// Dieser Code wurde von einem Tool generiert.
+// Laufzeitversion:4.0.30319.42000
+//
+// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
+// der Code erneut generiert wird.
+//
+//------------------------------------------------------------------------------
+
+namespace PlayerTags.Resources {
+ using System;
+
+
+ ///
+ /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
+ ///
+ // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
+ // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
+ // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
+ // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Paths {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Paths() {
+ }
+
+ ///
+ /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
+ ///
+ [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("PlayerTags.Resources.Paths", typeof(Paths).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
+ /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Words/Adjectives.txt ähnelt.
+ ///
+ internal static string AdjectivesTxt {
+ get {
+ return ResourceManager.GetString("AdjectivesTxt", resourceCulture);
+ }
+ }
+
+ ///
+ /// Sucht eine lokalisierte Zeichenfolge, die Words/Nouns.txt ähnelt.
+ ///
+ internal static string NounsTxt {
+ get {
+ return ResourceManager.GetString("NounsTxt", resourceCulture);
+ }
+ }
+ }
+}
diff --git a/PlayerTags/Resources/Paths.resx b/PlayerTags/Resources/Paths.resx
new file mode 100644
index 0000000..2de3cc2
--- /dev/null
+++ b/PlayerTags/Resources/Paths.resx
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Words/Adjectives.txt
+
+
+ Words/Nouns.txt
+
+
\ No newline at end of file