diff --git a/Dalamud/Game/Command/CommandManager.cs b/Dalamud/Game/Command/CommandManager.cs index 0ebebe83e..fcbfc6655 100644 --- a/Dalamud/Game/Command/CommandManager.cs +++ b/Dalamud/Game/Command/CommandManager.cs @@ -71,7 +71,7 @@ internal sealed unsafe class CommandManager : IInternalDisposableService, IComma if (separatorPosition + 1 >= content.Length) { // Remove the trailing space - command = content.Substring(0, separatorPosition); + command = content[..separatorPosition]; } else { diff --git a/Dalamud/Interface/Internal/ImGuiInputTextStatePtrExtensions.cs b/Dalamud/Interface/Internal/ImGuiInputTextStatePtrExtensions.cs index ab5fdaac8..e27c20d06 100644 --- a/Dalamud/Interface/Internal/ImGuiInputTextStatePtrExtensions.cs +++ b/Dalamud/Interface/Internal/ImGuiInputTextStatePtrExtensions.cs @@ -110,7 +110,7 @@ internal static unsafe class ImGuiInputTextStatePtrExtensions var text = new Span(self.TextW.Data, self.TextW.Size); if (pos != textLen) - text.Slice(pos, textLen - pos).CopyTo(text[(pos + newText.Length)..]); + text[pos..textLen].CopyTo(text[(pos + newText.Length)..]); newText.CopyTo(text[pos..]); self.Edited = true; diff --git a/Dalamud/Interface/Style/StyleModel.cs b/Dalamud/Interface/Style/StyleModel.cs index 99dba204d..a2d69ce8f 100644 --- a/Dalamud/Interface/Style/StyleModel.cs +++ b/Dalamud/Interface/Style/StyleModel.cs @@ -68,7 +68,7 @@ public abstract class StyleModel /// Thrown in case the version of the model is not known. public static StyleModel? Deserialize(string model) { - var json = Util.DecompressString(Convert.FromBase64String(model.Substring(3))); + var json = Util.DecompressString(Convert.FromBase64String(model[3..])); if (model.StartsWith(StyleModelV1.SerializedPrefix)) return JsonConvert.DeserializeObject(json); diff --git a/Dalamud/Plugin/Internal/Loader/ManagedLoadContext.cs b/Dalamud/Plugin/Internal/Loader/ManagedLoadContext.cs index b6b22d867..fc7c0587d 100644 --- a/Dalamud/Plugin/Internal/Loader/ManagedLoadContext.cs +++ b/Dalamud/Plugin/Internal/Loader/ManagedLoadContext.cs @@ -243,7 +243,7 @@ internal class ManagedLoadContext : AssemblyLoadContext } // check to see if there is a library entry for the library without the file extension - var trimmedName = unmanagedDllName.Substring(0, unmanagedDllName.Length - suffix.Length); + var trimmedName = unmanagedDllName[..^suffix.Length]; if (this.nativeLibraries.TryGetValue(prefix + trimmedName, out library)) { diff --git a/Dalamud/Plugin/Internal/Profiles/ProfileModel.cs b/Dalamud/Plugin/Internal/Profiles/ProfileModel.cs index 87dab7beb..5b8fd593d 100644 --- a/Dalamud/Plugin/Internal/Profiles/ProfileModel.cs +++ b/Dalamud/Plugin/Internal/Profiles/ProfileModel.cs @@ -32,7 +32,7 @@ public abstract class ProfileModel /// Thrown when the parsed string is not a valid profile. public static ProfileModel? Deserialize(string model) { - var json = Util.DecompressString(Convert.FromBase64String(model.Substring(3))); + var json = Util.DecompressString(Convert.FromBase64String(model[3..])); if (model.StartsWith(ProfileModelV1.SerializedPrefix)) return JsonConvert.DeserializeObject(json); diff --git a/Dalamud/SafeMemory.cs b/Dalamud/SafeMemory.cs index 997352850..bd5ccba07 100644 --- a/Dalamud/SafeMemory.cs +++ b/Dalamud/SafeMemory.cs @@ -182,7 +182,7 @@ public static class SafeMemory return null; var data = encoding.GetString(buffer); var eosPos = data.IndexOf('\0'); - return eosPos == -1 ? data : data.Substring(0, eosPos); + return eosPos == -1 ? data : data[..eosPos]; } ///