diff --git a/implement/read-memory-64-bit/CommonConversion.cs b/implement/read-memory-64-bit/CommonConversion.cs index 5a94720..198a5c3 100644 --- a/implement/read-memory-64-bit/CommonConversion.cs +++ b/implement/read-memory-64-bit/CommonConversion.cs @@ -13,7 +13,7 @@ static public byte[] ByteArrayFromStringBase16(string base16) => .ToArray(); static public string StringBase16FromByteArray(IReadOnlyList bytes) => - BitConverter.ToString(bytes as byte[] ?? bytes.ToArray()).Replace("-", "").ToLowerInvariant(); + BitConverter.ToString(bytes as byte[] ?? [.. bytes]).Replace("-", "").ToLowerInvariant(); static public byte[] HashSHA256(byte[] input) => SHA256.HashData(input); @@ -56,7 +56,7 @@ static public byte[] Inflate(IReadOnlyList input) using var inflatedStream = new System.IO.MemoryStream(); using var deflateStream = new System.IO.Compression.DeflateStream( - new System.IO.MemoryStream(input as byte[] ?? input.ToArray()), System.IO.Compression.CompressionMode.Decompress); + new System.IO.MemoryStream(input as byte[] ?? [.. input]), System.IO.Compression.CompressionMode.Decompress); deflateStream.CopyTo(inflatedStream); diff --git a/implement/read-memory-64-bit/Program.cs b/implement/read-memory-64-bit/Program.cs index 1549330..f64f072 100644 --- a/implement/read-memory-64-bit/Program.cs +++ b/implement/read-memory-64-bit/Program.cs @@ -1029,7 +1029,7 @@ PyDictEntry[] ReadActiveDictionaryEntriesFromDictionaryAddress(ulong dictionaryA entries.Add(new PyDictEntry { hash = hash, key = key, value = value }); } - return entries.ToArray(); + return [.. entries]; } IImmutableDictionary GetDictionaryEntriesWithStringKeys(ulong dictionaryObjectAddress) @@ -1223,7 +1223,7 @@ UITreeNode[] ReadChildren() pythonObjectAddress: nodeAddress, pythonObjectTypeName: pythonObjectTypeName, dictEntriesOfInterest: dictEntriesOfInterestDict, - otherDictEntriesKeys: otherDictEntriesKeys.ToArray(), + otherDictEntriesKeys: [.. otherDictEntriesKeys], children: ReadChildren()?.Where(child => child != null)?.ToArray() ); } @@ -1562,7 +1562,7 @@ static public byte[] ZipArchiveFromProcessSample( var zipArchiveEntries = memoryRegions.ToImmutableDictionary( - region => (IImmutableList)(new[] { "Process", "Memory", $"0x{region.baseAddress:X}" }.ToImmutableList()), + region => (IImmutableList)(["Process", "Memory", $"0x{region.baseAddress:X}"]), region => region.content.Value.ToArray()) .Add(new[] { "copy-memory-log" }.ToImmutableList(), System.Text.Encoding.UTF8.GetBytes(String.Join("\n", logEntries))) .AddRange(screenshotEntries);