mirror of
https://github.com/Ryubing/Ryujinx.git
synced 2025-03-15 04:14:47 +00:00
misc: chore: Fix object creation in Common project
This commit is contained in:
parent
ae92fbf539
commit
7f5a356c3d
5 changed files with 12 additions and 12 deletions
|
@ -164,7 +164,7 @@ namespace Ryujinx.Common.Extensions
|
|||
// Not enough data in the current segment, try to peek for the data we need.
|
||||
T buffer = default;
|
||||
|
||||
Span<byte> tempSpan = new Span<byte>(&buffer, sizeof(T));
|
||||
Span<byte> tempSpan = new(&buffer, sizeof(T));
|
||||
|
||||
if (!reader.TryCopyTo(tempSpan))
|
||||
{
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace Ryujinx.Common
|
|||
return null;
|
||||
}
|
||||
|
||||
using StreamReader reader = new StreamReader(stream);
|
||||
using StreamReader reader = new(stream);
|
||||
return reader.ReadToEnd();
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ namespace Ryujinx.Common
|
|||
return null;
|
||||
}
|
||||
|
||||
using StreamReader reader = new StreamReader(stream);
|
||||
using StreamReader reader = new(stream);
|
||||
return await reader.ReadToEndAsync();
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace Ryujinx.Common.Utilities
|
|||
public static void CopyDirectory(string sourceDir, string destinationDir, bool recursive)
|
||||
{
|
||||
// Get information about the source directory
|
||||
DirectoryInfo dir = new DirectoryInfo(sourceDir);
|
||||
DirectoryInfo dir = new(sourceDir);
|
||||
|
||||
// Check if the source directory exists
|
||||
if (!dir.Exists)
|
||||
|
@ -49,7 +49,7 @@ namespace Ryujinx.Common.Utilities
|
|||
|
||||
public static string SanitizeFileName(string fileName)
|
||||
{
|
||||
HashSet<char> reservedChars = new HashSet<char>(Path.GetInvalidFileNameChars());
|
||||
HashSet<char> reservedChars = new(Path.GetInvalidFileNameChars());
|
||||
return string.Concat(fileName.Select(c => reservedChars.Contains(c) ? '_' : c));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace Ryujinx.Common.Utilities
|
|||
|
||||
public static string Format(MessagePackObject obj)
|
||||
{
|
||||
IndentedStringBuilder builder = new IndentedStringBuilder();
|
||||
IndentedStringBuilder builder = new();
|
||||
|
||||
FormatMsgPackObj(obj, builder);
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace Ryujinx.Common.Utilities
|
|||
{
|
||||
if (Path.GetExtension(filename).Equals(".XCI", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
XCIFileTrimmer trimmer = new XCIFileTrimmer(filename, log);
|
||||
XCIFileTrimmer trimmer = new(filename, log);
|
||||
return trimmer.CanBeTrimmed;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ namespace Ryujinx.Common.Utilities
|
|||
{
|
||||
if (Path.GetExtension(filename).Equals(".XCI", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
XCIFileTrimmer trimmer = new XCIFileTrimmer(filename, log);
|
||||
XCIFileTrimmer trimmer = new(filename, log);
|
||||
return trimmer.CanBeUntrimmed;
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ namespace Ryujinx.Common.Utilities
|
|||
|
||||
try
|
||||
{
|
||||
FileInfo info = new FileInfo(Filename);
|
||||
FileInfo info = new(Filename);
|
||||
if ((info.Attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
|
||||
{
|
||||
try
|
||||
|
@ -288,7 +288,7 @@ namespace Ryujinx.Common.Utilities
|
|||
return OperationOutcome.FileSizeChanged;
|
||||
}
|
||||
|
||||
FileStream outfileStream = new FileStream(_filename, FileMode.Open, FileAccess.Write, FileShare.Write);
|
||||
FileStream outfileStream = new(_filename, FileMode.Open, FileAccess.Write, FileShare.Write);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -327,7 +327,7 @@ namespace Ryujinx.Common.Utilities
|
|||
{
|
||||
Log?.Write(LogType.Info, "Untrimming...");
|
||||
|
||||
FileInfo info = new FileInfo(Filename);
|
||||
FileInfo info = new(Filename);
|
||||
if ((info.Attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
|
||||
{
|
||||
try
|
||||
|
@ -348,7 +348,7 @@ namespace Ryujinx.Common.Utilities
|
|||
return OperationOutcome.FileSizeChanged;
|
||||
}
|
||||
|
||||
FileStream outfileStream = new FileStream(_filename, FileMode.Append, FileAccess.Write, FileShare.Write);
|
||||
FileStream outfileStream = new(_filename, FileMode.Append, FileAccess.Write, FileShare.Write);
|
||||
long bytesToWriteB = UntrimmedFileSizeB - FileSizeB;
|
||||
|
||||
try
|
||||
|
|
Loading…
Add table
Reference in a new issue