mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-20 06:47:44 +01:00
Fix IDE0057: Substring can be simplified
This commit is contained in:
parent
94b7f89281
commit
3050ea7ded
6 changed files with 6 additions and 6 deletions
|
|
@ -71,7 +71,7 @@ internal sealed unsafe class CommandManager : IInternalDisposableService, IComma
|
||||||
if (separatorPosition + 1 >= content.Length)
|
if (separatorPosition + 1 >= content.Length)
|
||||||
{
|
{
|
||||||
// Remove the trailing space
|
// Remove the trailing space
|
||||||
command = content.Substring(0, separatorPosition);
|
command = content[..separatorPosition];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ internal static unsafe class ImGuiInputTextStatePtrExtensions
|
||||||
|
|
||||||
var text = new Span<char>(self.TextW.Data, self.TextW.Size);
|
var text = new Span<char>(self.TextW.Data, self.TextW.Size);
|
||||||
if (pos != textLen)
|
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..]);
|
newText.CopyTo(text[pos..]);
|
||||||
|
|
||||||
self.Edited = true;
|
self.Edited = true;
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ public abstract class StyleModel
|
||||||
/// <exception cref="ArgumentException">Thrown in case the version of the model is not known.</exception>
|
/// <exception cref="ArgumentException">Thrown in case the version of the model is not known.</exception>
|
||||||
public static StyleModel? Deserialize(string model)
|
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))
|
if (model.StartsWith(StyleModelV1.SerializedPrefix))
|
||||||
return JsonConvert.DeserializeObject<StyleModelV1>(json);
|
return JsonConvert.DeserializeObject<StyleModelV1>(json);
|
||||||
|
|
|
||||||
|
|
@ -243,7 +243,7 @@ internal class ManagedLoadContext : AssemblyLoadContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// check to see if there is a library entry for the library without the file extension
|
// 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))
|
if (this.nativeLibraries.TryGetValue(prefix + trimmedName, out library))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ public abstract class ProfileModel
|
||||||
/// <exception cref="ArgumentException">Thrown when the parsed string is not a valid profile.</exception>
|
/// <exception cref="ArgumentException">Thrown when the parsed string is not a valid profile.</exception>
|
||||||
public static ProfileModel? Deserialize(string model)
|
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))
|
if (model.StartsWith(ProfileModelV1.SerializedPrefix))
|
||||||
return JsonConvert.DeserializeObject<ProfileModelV1>(json);
|
return JsonConvert.DeserializeObject<ProfileModelV1>(json);
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ public static class SafeMemory
|
||||||
return null;
|
return null;
|
||||||
var data = encoding.GetString(buffer);
|
var data = encoding.GetString(buffer);
|
||||||
var eosPos = data.IndexOf('\0');
|
var eosPos = data.IndexOf('\0');
|
||||||
return eosPos == -1 ? data : data.Substring(0, eosPos);
|
return eosPos == -1 ? data : data[..eosPos];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue