Skip to content

Commit 04120e8

Browse files
committed
refact: readonly 是有用的 (虽然不多
1 parent 6326aad commit 04120e8

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

CurvaLauncher.Plugins.Hashing/HashingPlugin.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class HashingPlugin : CommandSyncI18nPlugin
1717
public override object DescriptionKey => "StrPluginDescription";
1818

1919

20-
static Dictionary<string, HashAlgorithm> _hashAlgorithmMap = new()
20+
static readonly Dictionary<string, HashAlgorithm> _hashAlgorithmMap = new()
2121
{
2222
["MD5"] = MD5.Create(),
2323
["SHA1"] = SHA1.Create(),
@@ -47,13 +47,13 @@ public override IEnumerable<IQueryResult> ExecuteCommand(string commandName, Com
4747
string title = $"Get summary with {algorithmName}";
4848

4949
var textFactories = arguments
50-
.Select(arg => (Func<Stream>)(() => new MemoryStream(Encoding.UTF8.GetBytes(arg.Value))));
50+
.Select(arg => (Func<Stream>)(() => new MemoryStream(Encoding.UTF8.GetBytes(arg.Value))));
5151

5252
if (anyFileExist)
5353
{
5454
var fileFactories = arguments
55-
.Where(arg => File.Exists(arg.Value))
56-
.Select(arg => (Func<Stream>)(() => File.OpenRead(arg.Value)));
55+
.Where(arg => File.Exists(arg.Value))
56+
.Select(arg => (Func<Stream>)(() => File.OpenRead(arg.Value)));
5757

5858
yield return new HashingQueryResult(fileFactories,
5959
hashAlgorithm,

0 commit comments

Comments
 (0)