Преглед изворни кода

misc: chore: Use string.Empty in more places where it's snuck back

Evan Husted пре 1 година
родитељ
комит
2acc43e968

+ 1 - 1
src/Ryujinx.Graphics.Metal/HardwareInfo.cs

@@ -76,7 +76,7 @@ namespace Ryujinx.Graphics.Metal
                 return model;
             }
 
-            return "";
+            return string.Empty;
         }
     }
 }

+ 6 - 6
src/Ryujinx.Graphics.Shader/CodeGen/Msl/Declarations.cs

@@ -218,7 +218,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
 
             foreach (MemoryDefinition memory in memories)
             {
-                string arraySize = "";
+                string arraySize = string.Empty;
                 if ((memory.Type & AggregateType.Array) != 0)
                 {
                     arraySize = $"[{memory.ArrayLength}]";
@@ -240,7 +240,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
                 BufferDefinition buffer = buffers[i];
 
                 bool needsPadding = buffer.Layout == BufferLayout.Std140;
-                string fsiSuffix = !constant && fsi ? " [[raster_order_group(0)]]" : "";
+                string fsiSuffix = !constant && fsi ? " [[raster_order_group(0)]]" : string.Empty;
 
                 bufferDec[i] = $"{addressSpace} {Defaults.StructPrefix}_{buffer.Name}* {buffer.Name}{fsiSuffix};";
 
@@ -257,7 +257,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
                     type &= ~AggregateType.Array;
 
                     string typeName = GetVarTypeName(type);
-                    string arraySuffix = "";
+                    string arraySuffix = string.Empty;
 
                     if (field.Type.HasFlag(AggregateType.Array))
                     {
@@ -353,7 +353,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
                     imageTypeName = $"array<{imageTypeName}, {image.ArrayLength}>";
                 }
 
-                string fsiSuffix = fsi ? " [[raster_order_group(0)]]" : "";
+                string fsiSuffix = fsi ? " [[raster_order_group(0)]]" : string.Empty;
 
                 imageDec[i] = $"{imageTypeName} {image.Name}{fsiSuffix};";
             }
@@ -454,7 +454,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
                         IoVariable.VertexIndex => "[[vertex_id]]",
                         // IoVariable.PointCoord => "[[point_coord]]",
                         IoVariable.UserDefined => context.Definitions.Stage == ShaderStage.Fragment ? $"[[user(loc{ioDefinition.Location})]]" : $"[[attribute({ioDefinition.Location})]]",
-                        _ => ""
+                        _ => string.Empty
                     };
 
                     context.AppendLine($"{type} {name} {iq}{suffix};");
@@ -545,7 +545,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
                         IoVariable.FragmentOutputColor => $"[[color({ioDefinition.Location})]]",
                         IoVariable.FragmentOutputDepth => "[[depth(any)]]",
                         IoVariable.ClipDistance => $"[[clip_distance]][{Defaults.TotalClipDistances}]",
-                        _ => ""
+                        _ => string.Empty
                     };
 
                     context.AppendLine($"{type} {name} {suffix};");

+ 5 - 5
src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/InstGenMemory.cs

@@ -27,7 +27,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
                 inputsCount--;
             }
 
-            string fieldName = "";
+            string fieldName = string.Empty;
             switch (storageKind)
             {
                 case StorageKind.ConstantBuffer:
@@ -140,7 +140,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
                 }
             }
             varName += fieldName;
-            varName += fieldHasPadding ? ".x" : "";
+            varName += fieldHasPadding ? ".x" : string.Empty;
 
             if (isStore)
             {
@@ -434,7 +434,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
 
                 string prefix = intCoords ? "uint" : "float";
 
-                return prefix + (count > 1 ? count : "") + "(" + coords + ")";
+                return prefix + (count > 1 ? count : string.Empty) + "(" + coords + ")";
             }
 
             Append(AssemblePVector(pCount));
@@ -504,7 +504,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
             }
 
             texCallBuilder.Append(')');
-            texCallBuilder.Append(colorIsVector ? GetMaskMultiDest(texOp.Index) : "");
+            texCallBuilder.Append(colorIsVector ? GetMaskMultiDest(texOp.Index) : string.Empty);
 
             return texCallBuilder.ToString();
         }
@@ -558,7 +558,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
         {
             if (mask == 0x0)
             {
-                return "";
+                return string.Empty;
             }
 
             string swizzle = ".";

+ 1 - 1
src/Ryujinx.Graphics.Shader/CodeGen/Msl/MslGenerator.cs

@@ -15,7 +15,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
             if (parameters.Definitions.Stage is not (ShaderStage.Vertex or ShaderStage.Fragment or ShaderStage.Compute))
             {
                 Logger.Warning?.Print(LogClass.Gpu, $"Attempted to generate unsupported shader type {parameters.Definitions.Stage}!");
-                return "";
+                return string.Empty;
             }
 
             CodeGenContext context = new(info, parameters);

+ 1 - 1
src/Ryujinx.Graphics.Shader/SamplerType.cs

@@ -199,7 +199,7 @@ namespace Ryujinx.Graphics.Shader
                 _ => "float"
             };
 
-            return $"{typeName}<{format}{(image ? ", access::read_write" : "")}>";
+            return $"{typeName}<{format}{(image ? ", access::read_write" : string.Empty)}>";
         }
     }
 }

+ 1 - 1
src/Ryujinx.HLE/HOS/ModLoader.cs

@@ -679,7 +679,7 @@ namespace Ryujinx.HLE.HOS
             {
                 using (MD5 md5 = MD5.Create())
                 {
-                    modLoadResult.Hash += BitConverter.ToString(md5.ComputeHash(tempHash.ToBytes())).Replace("-", "").ToLowerInvariant();
+                    modLoadResult.Hash += BitConverter.ToString(md5.ComputeHash(tempHash.ToBytes())).Replace("-", string.Empty).ToLowerInvariant();
                 }
             }
 

+ 1 - 1
src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/LdnMasterProxyClient.cs

@@ -121,7 +121,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu
 
         private void UpdatePassphraseIfNeeded()
         {
-            string passphrase = _config.MultiplayerLdnPassphrase ?? "";
+            string passphrase = _config.MultiplayerLdnPassphrase ?? string.Empty;
             if (passphrase != _passphrase)
             {
                 _passphrase = passphrase;

+ 1 - 1
src/Ryujinx.HLE/Loaders/Processes/ProcessResult.cs

@@ -88,7 +88,7 @@ namespace Ryujinx.HLE.Loaders.Processes
             bool isFirmwareApplication = ProgramId <= 0x0100000000007FFF;
 
             string name = !isFirmware
-                ? (isFirmwareApplication ? "Firmware Application " : "") + (!string.IsNullOrWhiteSpace(Name) ? Name : "<Unknown Name>")
+                ? (isFirmwareApplication ? "Firmware Application " : string.Empty) + (!string.IsNullOrWhiteSpace(Name) ? Name : "<Unknown Name>")
                 : "Firmware";
 
             // TODO: LibHac npdm currently doesn't support version field.

+ 5 - 2
src/Ryujinx/UI/Views/Settings/SettingsNetworkView.axaml.cs

@@ -7,23 +7,26 @@ namespace Ryujinx.Ava.UI.Views.Settings
 {
     public partial class SettingsNetworkView : UserControl
     {
+        private readonly Random _random;
+        
         public SettingsViewModel ViewModel;
 
         public SettingsNetworkView()
         {
+            _random = new Random();
             InitializeComponent();
         }
 
         private void GenLdnPassButton_OnClick(object sender, RoutedEventArgs e)
         {
             byte[] code = new byte[4];
-            new Random().NextBytes(code);
+            _random.NextBytes(code);
             ViewModel.LdnPassphrase = $"Ryujinx-{BitConverter.ToUInt32(code):x8}";
         }
 
         private void ClearLdnPassButton_OnClick(object sender, RoutedEventArgs e)
         {
-            ViewModel.LdnPassphrase = "";
+            ViewModel.LdnPassphrase = string.Empty;
         }
     }
 }

+ 2 - 2
src/Ryujinx/Utilities/Configuration/ConfigurationState.cs

@@ -204,8 +204,8 @@ namespace Ryujinx.Ava.Utilities.Configuration
             Multiplayer.LanInterfaceId.Value = "0";
             Multiplayer.Mode.Value = MultiplayerMode.Disabled;
             Multiplayer.DisableP2p.Value = false;
-            Multiplayer.LdnPassphrase.Value = "";
-            Multiplayer.LdnServer.Value = "";
+            Multiplayer.LdnPassphrase.Value = string.Empty;
+            Multiplayer.LdnServer.Value = string.Empty;
             UI.GuiColumns.FavColumn.Value = true;
             UI.GuiColumns.IconColumn.Value = true;
             UI.GuiColumns.AppColumn.Value = true;