Don't move to another macro if it's only going to have one step

This commit is contained in:
Asriel Camora
2023-10-24 01:07:26 -07:00
parent 889d07433c
commit cd0fbacbbc
3 changed files with 27 additions and 11 deletions
+1
View File
@@ -59,6 +59,7 @@ public class MacroCopyConfiguration
public bool AddNotification { get; set; } = true;
// Requires AddNotification
public bool ForceNotification { get; set; }
public bool AddNotificationSound { get; set; } = true;
public int IntermediateNotificationSound { get; set; } = 10;
public int EndNotificationSound { get; set; } = 6;
+17 -11
View File
@@ -37,24 +37,30 @@ public static class MacroCopy
s.Add(GetActionCommand(actions[i], config));
if (i != actions.Count - 1 && (config.Type == MacroCopyConfiguration.CopyType.CopyToMacro || !config.CombineMacro))
if (config.Type == MacroCopyConfiguration.CopyType.CopyToMacro || !config.CombineMacro)
{
if (s.Count == MacroSize - 1)
if (i != actions.Count - 1 && (i != actions.Count - 2 || config.ForceNotification))
{
if (GetEndCommand(macros.Count, false, config) is { } endCommand)
s.Add(endCommand);
}
if (s.Count == MacroSize)
{
macros.Add(string.Join(Environment.NewLine, s));
s.Clear();
if (s.Count == MacroSize - 1)
{
if (GetEndCommand(macros.Count, false, config) is { } endCommand)
s.Add(endCommand);
}
if (s.Count == MacroSize)
{
macros.Add(string.Join(Environment.NewLine, s));
s.Clear();
}
}
}
}
if (s.Count > 0)
{
if (GetEndCommand(macros.Count, true, config) is { } endCommand)
s.Add(endCommand);
if (s.Count < MacroSize)
{
if (GetEndCommand(macros.Count, true, config) is { } endCommand)
s.Add(endCommand);
}
macros.Add(string.Join(Environment.NewLine, s));
}
+9
View File
@@ -280,6 +280,15 @@ public sealed class Settings : Window, IDisposable
if (Config.MacroCopy.AddNotification)
{
DrawOption(
"Force Notification",
"Prioritize always having a notification sound at the end of\n" +
"every macro. Keeping this off prevents macros with only 1 action.",
Config.MacroCopy.ForceNotification,
v => Config.MacroCopy.ForceNotification = v,
ref isDirty
);
DrawOption(
"Add Notification Sound",
"Adds a sound to the end of every macro.",