diff --git a/CustomizePlus/Core/Extensions/StringExtensions.cs b/CustomizePlus/Core/Extensions/StringExtensions.cs index aefb33b..a9c9721 100644 --- a/CustomizePlus/Core/Extensions/StringExtensions.cs +++ b/CustomizePlus/Core/Extensions/StringExtensions.cs @@ -16,6 +16,9 @@ internal static class StringExtensions #if !INCOGNIFY_STRINGS return str; #endif + + str = str.Trim(); + if (str.Contains(" ")) { var split = str.Split(' '); diff --git a/CustomizePlus/Profiles/Data/Profile.cs b/CustomizePlus/Profiles/Data/Profile.cs index 9577359..6a67907 100644 --- a/CustomizePlus/Profiles/Data/Profile.cs +++ b/CustomizePlus/Profiles/Data/Profile.cs @@ -145,8 +145,8 @@ public sealed class Profile : ISavable { CreationDate = creationDate, UniqueId = obj["UniqueId"]?.ToObject() ?? throw new ArgumentNullException("UniqueId"), - Name = new LowerString(obj["Name"]?.ToObject() ?? throw new ArgumentNullException("Name")), - CharacterName = new LowerString(obj["CharacterName"]?.ToObject() ?? throw new ArgumentNullException("CharacterName")), + Name = new LowerString(obj["Name"]?.ToObject()?.Trim() ?? throw new ArgumentNullException("Name")), + CharacterName = new LowerString(obj["CharacterName"]?.ToObject()?.Trim() ?? throw new ArgumentNullException("CharacterName")), LimitLookupToOwnedObjects = obj["LimitLookupToOwnedObjects"]?.ToObject() ?? throw new ArgumentNullException("LimitLookupToOwnedObjects"), Enabled = obj["Enabled"]?.ToObject() ?? throw new ArgumentNullException("Enabled"), ModifiedDate = obj["ModifiedDate"]?.ToObject() ?? creationDate, diff --git a/CustomizePlus/Profiles/ProfileManager.cs b/CustomizePlus/Profiles/ProfileManager.cs index ac275a2..0e467ea 100644 --- a/CustomizePlus/Profiles/ProfileManager.cs +++ b/CustomizePlus/Profiles/ProfileManager.cs @@ -199,6 +199,8 @@ public class ProfileManager : IDisposable /// public void Rename(Profile profile, string newName) { + newName = newName.Trim(); + var oldName = profile.Name.Text; if (oldName == newName) return; @@ -216,6 +218,8 @@ public class ProfileManager : IDisposable /// public void ChangeCharacterName(Profile profile, string newName) { + newName = newName.Trim(); + var oldName = profile.CharacterName.Text; if (oldName == newName) return; diff --git a/CustomizePlus/Templates/Data/Template.cs b/CustomizePlus/Templates/Data/Template.cs index 1a520a0..30938b2 100644 --- a/CustomizePlus/Templates/Data/Template.cs +++ b/CustomizePlus/Templates/Data/Template.cs @@ -93,7 +93,7 @@ public sealed class Template : ISavable { CreationDate = creationDate, UniqueId = obj["UniqueId"]?.ToObject() ?? throw new ArgumentNullException("UniqueId"), - Name = new LowerString(obj["Name"]?.ToObject() ?? throw new ArgumentNullException("Name")), + Name = new LowerString(obj["Name"]?.ToObject()?.Trim() ?? throw new ArgumentNullException("Name")), ModifiedDate = obj["ModifiedDate"]?.ToObject() ?? creationDate, Bones = obj["Bones"]?.ToObject>() ?? throw new ArgumentNullException("Bones"), IsWriteProtected = obj["IsWriteProtected"]?.ToObject() ?? false diff --git a/CustomizePlus/Templates/TemplateManager.cs b/CustomizePlus/Templates/TemplateManager.cs index 1a80207..2048c2b 100644 --- a/CustomizePlus/Templates/TemplateManager.cs +++ b/CustomizePlus/Templates/TemplateManager.cs @@ -141,6 +141,8 @@ public class TemplateManager /// public void Rename(Template template, string newName) { + newName = newName.Trim(); + var oldName = template.Name.Text; if (oldName == newName) return;