mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 20:07:21 +01:00
Add plugin command to toggle connection
This commit is contained in:
parent
d5f56b6e52
commit
630f958bd2
1 changed files with 27 additions and 0 deletions
|
|
@ -204,6 +204,33 @@ namespace MareSynchronos
|
||||||
if (string.IsNullOrEmpty(args))
|
if (string.IsNullOrEmpty(args))
|
||||||
{
|
{
|
||||||
OpenUi();
|
OpenUi();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var splitArgs = args.ToLowerInvariant().Trim().Split();
|
||||||
|
|
||||||
|
if (splitArgs.Length == 0)
|
||||||
|
{
|
||||||
|
// Interpret this as toggling the UI
|
||||||
|
OpenUi();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (splitArgs[0] == "toggle")
|
||||||
|
{
|
||||||
|
var fullPause = splitArgs.Length > 1 ? splitArgs[1] switch
|
||||||
|
{
|
||||||
|
"on" => false,
|
||||||
|
"off" => true,
|
||||||
|
_ => !_configuration.FullPause,
|
||||||
|
} : !_configuration.FullPause;
|
||||||
|
|
||||||
|
if (fullPause != _configuration.FullPause)
|
||||||
|
{
|
||||||
|
_configuration.FullPause = fullPause;
|
||||||
|
_configuration.Save();
|
||||||
|
_ = _apiController.CreateConnections();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue