Skip to content

Commit 79c1440

Browse files
committed
chore: RP review
1 parent dcfdb59 commit 79c1440

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

src/Uno.UI.RemoteControl/HotReload/Messages/ConfigureServer.cs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Linq;
34
using System.Text;
45

56
namespace Uno.UI.RemoteControl.HotReload.Messages;
67

78
/// <summary>
8-
///
9+
/// Configuration message sent from the client to the server to initialize hot reload functionality.
910
/// </summary>
1011
/// <param name="ProjectPath"></param>
1112
/// <param name="MetadataUpdateCapabilities"></param>
@@ -36,16 +37,10 @@ public record ConfigureServer(
3637
public Dictionary<string, string> MSBuildProperties => _msbuildProperties ??= ParseMSBuildProperties(MSBuildPropertiesRaw);
3738

3839
public static Dictionary<string, string> ParseMSBuildProperties(string[] rawMSBuildProperties)
39-
{
40-
var msbuildPropertiesCache = new Dictionary<string, string>();
41-
42-
foreach (var property in rawMSBuildProperties)
43-
{
44-
var firstEqual = property.IndexOf('=');
45-
var split = new[] { property.Substring(0, firstEqual), property.Substring(firstEqual + 1) };
46-
msbuildPropertiesCache.Add(split[0], Encoding.UTF8.GetString(Convert.FromBase64String(split[1])));
47-
}
48-
49-
return msbuildPropertiesCache;
50-
}
40+
=> rawMSBuildProperties
41+
.Select(property => property.Split('=', 2))
42+
.Where(tokens => tokens.Length == 2)
43+
.ToDictionary(
44+
tokens => tokens[0],
45+
split => Encoding.UTF8.GetString(Convert.FromBase64String(split[1])));
5146
}

0 commit comments

Comments
 (0)