Added "trigger dump" command to dump the configured triggers as commands for copy'n'paste
This commit is contained in:
parent
fce5814bcb
commit
238b5db4f7
|
@ -206,6 +206,9 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.Other
|
|||
SCore.PerformanceCounterManager.PauseAlerts = false;
|
||||
monitor.Log($"Alerts are now resumed.", LogLevel.Info);
|
||||
break;
|
||||
case "dump":
|
||||
this.OutputAlertTriggers(monitor, true);
|
||||
break;
|
||||
case "clear":
|
||||
this.ClearAlertTriggers(monitor);
|
||||
break;
|
||||
|
@ -308,7 +311,8 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.Other
|
|||
|
||||
/// <summary>Lists all configured alert triggers.</summary>
|
||||
/// <param name="monitor">Writes messages to the console and log file.</param>
|
||||
private void OutputAlertTriggers(IMonitor monitor)
|
||||
/// <param name="asDump">True to dump the triggers as commands.</param>
|
||||
private void OutputAlertTriggers(IMonitor monitor, bool asDump = false)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine("Configured triggers:");
|
||||
|
@ -332,6 +336,16 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.Other
|
|||
{
|
||||
sb.AppendLine("Collection Triggers:");
|
||||
sb.AppendLine();
|
||||
|
||||
if (asDump)
|
||||
{
|
||||
foreach (var item in collectionTriggers)
|
||||
{
|
||||
sb.AppendLine($"pc trigger {item.collectionName} {item.threshold}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.AppendLine(this.GetTableString(
|
||||
data: collectionTriggers,
|
||||
header: new[] {"Collection", "Threshold"},
|
||||
|
@ -342,6 +356,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.Other
|
|||
},
|
||||
true
|
||||
));
|
||||
}
|
||||
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
@ -354,6 +369,16 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.Other
|
|||
{
|
||||
sb.AppendLine("Source Triggers:");
|
||||
sb.AppendLine();
|
||||
|
||||
if (asDump)
|
||||
{
|
||||
foreach (var item in sourceTriggers)
|
||||
{
|
||||
sb.AppendLine($"pc trigger {item.collectionName} {item.threshold} {item.sourceName}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.AppendLine(this.GetTableString(
|
||||
data: sourceTriggers,
|
||||
header: new[] {"Collection", "Source", "Threshold"},
|
||||
|
@ -365,6 +390,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.Other
|
|||
},
|
||||
true
|
||||
));
|
||||
}
|
||||
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
@ -560,6 +586,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.Other
|
|||
sb.AppendLine(" - clear Clears all trigger entries");
|
||||
sb.AppendLine(" - pause Pauses triggering of alerts");
|
||||
sb.AppendLine(" - resume Resumes triggering of alerts");
|
||||
sb.AppendLine(" - dump Dumps all triggers as commands for copy and paste");
|
||||
sb.AppendLine(" Defaults to 'list' if not specified.");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine(" <collectionName> Required if the mode 'collection' is specified.");
|
||||
|
|
Loading…
Reference in New Issue