-
Notifications
You must be signed in to change notification settings - Fork 3
/
VisualStudioInstance.cs
33 lines (28 loc) · 1.33 KB
/
VisualStudioInstance.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using System.IO;
using System.Text.Json;
namespace Flow.Launcher.Plugin.VisualStudio
{
public class VisualStudioInstance
{
public string InstanceId { get; init; }
public Version InstallationVersion { get; init; }
public string ExePath { get; init; }
public string DisplayName { get; init; }
public string RecentItemsPath { get; init; }
public string DisplayVersion { get; init; }
public VisualStudioInstance(JsonElement element)
{
var instanceId = element.GetProperty("instanceId").GetString();
InstallationVersion = element.GetProperty("installationVersion").Deserialize<Version>();
ExePath = element.GetProperty("productPath").GetString();
DisplayName = element.GetProperty("displayName").GetString();
DisplayVersion = element.GetProperty("catalog").GetProperty("productDisplayVersion").GetString();
InstanceId = $"{InstallationVersion.Major}.0_{instanceId}";
RecentItemsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"Microsoft\\VisualStudio",
InstanceId,
"ApplicationPrivateSettings.xml");
}
}
}