misc: Replace "" with string.Empty.

This commit is contained in:
Evan Husted 2024-11-01 11:57:23 -05:00
parent 9305d171e7
commit 139c195eb7
52 changed files with 1649 additions and 1636 deletions

View file

@ -523,7 +523,7 @@ namespace Ryujinx.HLE.FileSystem
{
// Clean up the name and get the NcaId
string[] pathComponents = entry.FullName.Replace(".cnmt", "").Split('/');
string[] pathComponents = entry.FullName.Replace(".cnmt", string.Empty).Split('/');
string ncaId = pathComponents[^1];

View file

@ -132,7 +132,7 @@ namespace Ryujinx.HLE.FileSystem
if (systemPath.StartsWith(baseSystemPath))
{
string rawPath = systemPath.Replace(baseSystemPath, "");
string rawPath = systemPath.Replace(baseSystemPath, string.Empty);
int firstSeparatorOffset = rawPath.IndexOf(Path.DirectorySeparatorChar);
if (firstSeparatorOffset == -1)

View file

@ -107,7 +107,7 @@ namespace Ryujinx.HLE.HOS.Applets.Error
private static string CleanText(string value)
{
return CleanTextRegex().Replace(value, "").Replace("\0", "");
return CleanTextRegex().Replace(value, string.Empty).Replace("\0", string.Empty);
}
private string GetMessageText(uint module, uint description, string key)
@ -129,17 +129,15 @@ namespace Ryujinx.HLE.HOS.Applets.Error
return CleanText(reader.ReadToEnd());
}
else
{
return "";
}
return string.Empty;
}
private string[] GetButtonsText(uint module, uint description, string key)
{
string buttonsText = GetMessageText(module, description, key);
return (buttonsText == "") ? null : buttonsText.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
return (buttonsText == string.Empty) ? null : buttonsText.Split(["\r\n", "\r", "\n"], StringSplitOptions.None);
}
private void ParseErrorCommonArg()
@ -156,7 +154,7 @@ namespace Ryujinx.HLE.HOS.Applets.Error
string message = GetMessageText(module, description, "DlgMsg");
if (message == "")
if (message == string.Empty)
{
message = "An error has occured.\n\nPlease try again later.";
}
@ -190,7 +188,7 @@ namespace Ryujinx.HLE.HOS.Applets.Error
// TODO: Handle the LanguageCode to return the translated "OK" and "Details".
if (detailsText.Trim() != "")
if (detailsText.Trim() != string.Empty)
{
buttons.Add("Details");
}

View file

@ -51,7 +51,7 @@ namespace Ryujinx.HLE.HOS.Applets
private byte[] _transferMemory;
private string _textValue = "";
private string _textValue = string.Empty;
private int _cursorBegin = 0;
private Encoding _encoding = Encoding.Unicode;
private KeyboardResult _lastResult = KeyboardResult.NotSet;

View file

@ -305,7 +305,7 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
{
SKRect bounds = SKRect.Empty;
if (text == "")
if (text == string.Empty)
{
paint.MeasureText(" ", ref bounds);
}
@ -321,7 +321,7 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
{
SKRect bounds = SKRect.Empty;
if (text == "")
if (text == string.Empty)
{
paint.MeasureText(" ", ref bounds);
}

View file

@ -7,7 +7,7 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
/// </summary>
internal class SoftwareKeyboardUIState
{
public string InputText = "";
public string InputText = string.Empty;
public int CursorBegin = 0;
public int CursorEnd = 0;
public bool AcceptPressed = false;

View file

@ -238,7 +238,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
}
else
{
info.SubName = "";
info.SubName = string.Empty;
}
info.ImageName = GetGuessedNsoNameFromIndex(imageIndex);

View file

@ -64,7 +64,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
{
if (userId.IsNull)
{
userId = new UserId(Guid.NewGuid().ToString().Replace("-", ""));
userId = new UserId(Guid.NewGuid().ToString().Replace("-", string.Empty));
}
UserProfile profile = new(userId, name, image);

View file

@ -1,3 +1,4 @@
using Gommon;
using Ryujinx.Common.Logging;
using Ryujinx.Common.Memory;
using Ryujinx.Common.Utilities;
@ -143,7 +144,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm
if (decompressedLdnData.Length != header.DecompressLength)
{
Logger.Error?.PrintMsg(LogClass.ServiceLdn, $"Decompress error: length does not match. ({decompressedLdnData.Length} != {header.DecompressLength})");
Logger.Error?.PrintMsg(LogClass.ServiceLdn, $"Decompress error data: '{string.Join("", decompressedLdnData.Select(x => (int)x).ToArray())}'");
Logger.Error?.PrintMsg(LogClass.ServiceLdn, $"Decompress error data: '{decompressedLdnData.Select(x => (int)x).JoinToString(string.Empty)}'");
return;
}

View file

@ -15,7 +15,7 @@ namespace Ryujinx.HLE.HOS.Services.Ngct
ulong bufferSize = context.Request.PtrBuff[0].Size;
bool isMatch = false;
string text = "";
string text = string.Empty;
if (bufferSize != 0)
{
@ -57,8 +57,8 @@ namespace Ryujinx.HLE.HOS.Services.Ngct
ulong bufferFilteredPosition = context.Request.RecvListBuff[0].Position;
string text = "";
string textFiltered = "";
string text = string.Empty;
string textFiltered = string.Empty;
if (bufferSize != 0)
{

File diff suppressed because it is too large Load diff

View file

@ -36,7 +36,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Nsd.Manager
// TODO: Load Environment from the savedata.
address = address.Replace("%", IManager.NsdSettings.Environment);
resolvedAddress = "";
resolvedAddress = string.Empty;
if (IManager.NsdSettings == null)
{

View file

@ -63,7 +63,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
if (size < 0)
{
return "";
return string.Empty;
}
ReadOnlySpan<byte> data = ReadInPlace((size + 1) * 2);

View file

@ -166,7 +166,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi.RootService
private ResultCode OpenDisplayImpl(ServiceCtx context, string name)
{
if (name == "")
if (name == string.Empty)
{
return ResultCode.InvalidValue;
}

View file

@ -102,7 +102,7 @@ namespace Ryujinx.HLE.Loaders.Executables
Match fsSdkMatch = FsSdkRegex().Match(rawTextBuffer);
if (fsSdkMatch.Success)
{
stringBuilder.AppendLine($" FS SDK Version: {fsSdkMatch.Value.Replace("sdk_version: ", "")}");
stringBuilder.AppendLine($" FS SDK Version: {fsSdkMatch.Value.Replace("sdk_version: ", string.Empty)}");
}
MatchCollection sdkMwMatches = SdkMwRegex().Matches(rawTextBuffer);

View file

@ -89,7 +89,7 @@ namespace Ryujinx.HLE.Loaders.Processes.Extensions
Logger.Warning?.Print(LogClass.Ptc, "Detected unsupported ExeFs modifications. PTC disabled.");
}
string programName = "";
string programName = string.Empty;
if (!isHomebrew && programId > 0x010000000000FFFF)
{

View file

@ -145,7 +145,7 @@ namespace Ryujinx.HLE.Loaders.Processes
IFileSystem dummyExeFs = null;
Stream romfsStream = null;
string programName = "";
string programName = string.Empty;
ulong programId = 0000000000000000;
// Load executable.

View file

@ -255,7 +255,7 @@ namespace Ryujinx.HLE.Loaders.Processes
{
NsoExecutable nso => Convert.ToHexString(nso.BuildId.ItemsRo.ToArray()),
NroExecutable nro => Convert.ToHexString(nro.Header.BuildId),
_ => "",
_ => string.Empty
}).ToUpper());
ulong[] nsoBase = new ulong[executables.Length];