Я хотел бы добавить некоторые записи профиля в профили терминала Windows. json файл.
Это мои текущие профили. json файл:
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"profiles":
{
"defaults":
{
// Put settings here that you want to apply to all profiles
},
"list":
[
{
// Make changes here to the powershell.exe profile
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false
},
{
// Make changes here to the cmd.exe profile
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "cmd",
"commandline": "cmd.exe",
"hidden": false
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": false,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
}
]
},
"schemes": [],
"keybindings": []
}
И я хотел бы добавить это, например, в массив «список»:
{
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff85ed}",
"name": "Git Bash",
"commandline": "git-bash.exe",
"hidden": false
}
Это мой текущий фиктивный код:
var profilesFile = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\profiles.json");
var options = new JsonSerializerOptions();
options.ReadCommentHandling = JsonCommentHandling.Skip;
var myObj = JsonSerializer.Deserialize<dynamic>(File.ReadAllBytes(profilesFile), options);
Но я не знаю, если я ' м на правильной дороге.