Skip to content

Commit

Permalink
misc: Replace "" with string.Empty.
Browse files Browse the repository at this point in the history
  • Loading branch information
GreemDev committed Nov 1, 2024
1 parent 9305d17 commit 139c195
Show file tree
Hide file tree
Showing 52 changed files with 1,649 additions and 1,636 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public float Volume

public OpenALHardwareDeviceDriver()
{
_device = ALC.OpenDevice("");
_device = ALC.OpenDevice(string.Empty);
_context = ALC.CreateContext(_device, new ALContextAttributes());
_updateRequiredEvent = new ManualResetEvent(false);
_pauseEvent = new ManualResetEvent(true);
Expand Down
6 changes: 3 additions & 3 deletions src/Ryujinx.Common/Configuration/AppDataManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public static string GetOrCreateLogsDir()

private static string SetUpLogsDir()
{
string logDir = "";
string logDir = string.Empty;

if (Mode == LaunchMode.Portable)
{
Expand Down Expand Up @@ -148,7 +148,7 @@ private static string SetUpLogsDir()
catch
{
Logger.Warning?.Print(LogClass.Application, $"Logging directory could not be created '{logDir}'");
logDir = "";
logDir = string.Empty;
}

if (string.IsNullOrEmpty(logDir))
Expand Down Expand Up @@ -179,7 +179,7 @@ private static string SetUpLogsDir()
catch
{
Logger.Warning?.Print(LogClass.Application, $"Logging directory could not be created '{logDir}'");
logDir = "";
logDir = string.Empty;
}

if (string.IsNullOrEmpty(logDir))
Expand Down
4 changes: 2 additions & 2 deletions src/Ryujinx.Common/GraphicsDriver/NVThreadedOptimization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ public static void SetThreadedOptimization(bool enabled)
};
application.AppName.Set("Ryujinx.exe");
application.UserFriendlyName.Set("Ryujinx");
application.Launcher.Set("");
application.FileInFolder.Set("");
application.Launcher.Set(string.Empty);
application.FileInFolder.Set(string.Empty);

Check(NvAPI_DRS_CreateApplication(handle, profileHandle, ref application));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.Common/Logging/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void PrintMsg(LogClass logClass, string message)
{
if (_enabledClasses[(int)logClass])
{
Updated?.Invoke(null, new LogEventArgs(Level, _time.Elapsed, Thread.CurrentThread.Name, FormatMessage(logClass, "", message)));
Updated?.Invoke(null, new LogEventArgs(Level, _time.Elapsed, Thread.CurrentThread.Name, FormatMessage(logClass, string.Empty, message)));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ string AssembleOffsetVector(int count)

bool colorIsVector = isGather || !isShadow;

texCall += ")" + (colorIsVector ? GetMaskMultiDest(texOp.Index) : "");
texCall += ")" + (colorIsVector ? GetMaskMultiDest(texOp.Index) : string.Empty);

return texCall;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Ryujinx.Graphics.Shader/Translation/FunctionMatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -830,12 +830,12 @@ private static void PrintTreeNode(TreeNode node, string indentation)

if (use.Node != null)
{
Console.Write($"{indentation} {separator}- ({(use.Inverted ? "INV " : "")}{use.Index})");
Console.Write($"{indentation} {separator}- ({(use.Inverted ? "INV " : string.Empty)}{use.Index})");
PrintTreeNode(use.Node, indentation + (last ? " " : " | "));
}
else
{
Console.WriteLine($"{indentation} {separator}- ({(use.Inverted ? "INV " : "")}{use.Index}) NULL");
Console.WriteLine($"{indentation} {separator}- ({(use.Inverted ? "INV " : string.Empty)}{use.Index}) NULL");
}
}
}
Expand All @@ -852,12 +852,12 @@ private static void PrintTreeNode(IPatternTreeNode node, string indentation)

if (use.Node != null)
{
Console.Write($"{indentation} {separator}- ({(use.Inverted ? "INV " : "")}{use.Index})");
Console.Write($"{indentation} {separator}- ({(use.Inverted ? "INV " : string.Empty)}{use.Index})");
PrintTreeNode(use.Node, indentation + (last ? " " : " | "));
}
else
{
Console.WriteLine($"{indentation} {separator}- ({(use.Inverted ? "INV " : "")}{use.Index}) NULL");
Console.WriteLine($"{indentation} {separator}- ({(use.Inverted ? "INV " : string.Empty)}{use.Index}) NULL");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.HLE.Generators/IpcServiceGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void Execute(GeneratorExecutionContext context)
{
if (className.Modifiers.Any(SyntaxKind.AbstractKeyword) || className.Modifiers.Any(SyntaxKind.PrivateKeyword) || !className.AttributeLists.Any(x => x.Attributes.Any(y => y.ToString().StartsWith("Service"))))
continue;
var name = GetFullName(className, context).Replace("global::", "");
var name = GetFullName(className, context).Replace("global::", string.Empty);
if (!name.StartsWith("Ryujinx.HLE.HOS.Services"))
continue;
var constructors = className.ChildNodes().Where(x => x.IsKind(SyntaxKind.ConstructorDeclaration)).Select(y => y as ConstructorDeclarationSyntax).ToArray();
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.HLE/FileSystem/ContentManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ private static void InstallFromZip(ZipArchive archive, string temporaryDirectory
{
// 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];

Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public static string SystemPathToSwitchPath(string systemPath)

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)
Expand Down
14 changes: 6 additions & 8 deletions src/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private static string SystemLanguageToLanguageKey(SystemLanguage systemLanguage)

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)
Expand All @@ -129,17 +129,15 @@ private string GetMessageText(uint module, uint description, string key)

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()
Expand All @@ -156,7 +154,7 @@ private void ParseErrorCommonArg()

string message = GetMessageText(module, description, "DlgMsg");

if (message == "")
if (message == string.Empty)
{
message = "An error has occured.\n\nPlease try again later.";
}
Expand Down Expand Up @@ -190,7 +188,7 @@ private void ParseApplicationErrorArg()

// TODO: Handle the LanguageCode to return the translated "OK" and "Details".

if (detailsText.Trim() != "")
if (detailsText.Trim() != string.Empty)
{
buttons.Add("Details");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ internal class SoftwareKeyboardApplet : IApplet

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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ private static SKRect MeasureString(string text, SKPaint paint)
{
SKRect bounds = SKRect.Empty;

if (text == "")
if (text == string.Empty)
{
paint.MeasureText(" ", ref bounds);
}
Expand All @@ -321,7 +321,7 @@ private static SKRect MeasureString(ReadOnlySpan<char> text, SKPaint paint)
{
SKRect bounds = SKRect.Empty;

if (text == "")
if (text == string.Empty)
{
paint.MeasureText(" ", ref bounds);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.HLE/HOS/Kernel/Process/HleProcessDebugger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ private bool AnalyzePointerFromImages(out PointerInfo info, ulong address)
}
else
{
info.SubName = "";
info.SubName = string.Empty;
}

info.ImageName = GetGuessedNsoNameFromIndex(imageIndex);
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.HLE/HOS/Services/Account/Acc/AccountManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public AccountManager(HorizonClient horizonClient, string initialProfileName = n
{
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);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Gommon;
using Ryujinx.Common.Logging;
using Ryujinx.Common.Memory;
using Ryujinx.Common.Utilities;
Expand Down Expand Up @@ -143,7 +144,7 @@ public void Read(scoped ref byte[] buffer, scoped ref int bufferEnd, byte[] data
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;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Ryujinx.HLE/HOS/Services/Ngct/NgctServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static ResultCode Match(ServiceCtx context)
ulong bufferSize = context.Request.PtrBuff[0].Size;

bool isMatch = false;
string text = "";
string text = string.Empty;

if (bufferSize != 0)
{
Expand Down Expand Up @@ -57,8 +57,8 @@ public static ResultCode Filter(ServiceCtx context)

ulong bufferFilteredPosition = context.Request.RecvListBuff[0].Position;

string text = "";
string textFiltered = "";
string text = string.Empty;
string textFiltered = string.Empty;

if (bufferSize != 0)
{
Expand Down
Loading

0 comments on commit 139c195

Please sign in to comment.