Skip to content

Commit

Permalink
Release 4.16.3.
Browse files Browse the repository at this point in the history
  • Loading branch information
sw3103 committed May 29, 2023
1 parent 29d3a63 commit 8ec8136
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
4x/packages/
4x/Move Mouse/bin/
4x/Move Mouse/obj/
4x/UWP Package/
4x/UWP Package/
.vs/
12 changes: 12 additions & 0 deletions 4x/Move Mouse/Actions/ActionBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public abstract class ActionBase : INotifyPropertyChanged
private IntervalRepeatMode _repeatMode;
private int _intervalThrottle;
private int _intervalExecutionCount;
private bool _interruptsIdleTime;

public enum EventTrigger
{
Expand Down Expand Up @@ -116,6 +117,17 @@ public int IntervalExecutionCount
}
}

[XmlIgnore]
public bool InterruptsIdleTime
{
get => _interruptsIdleTime;
set
{
_interruptsIdleTime = value;
OnPropertyChanged();
}
}

protected ActionBase()
{
Id = Guid.NewGuid();
Expand Down
2 changes: 1 addition & 1 deletion 4x/Move Mouse/Actions/ActivateApplicationAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ private void RefreshApplications()

public override string ToString()
{
return $"{this.GetType().Name} | Name = {Name} | Mode = {Mode} | Application = {Application} | Trigger = {Trigger} | Repeat = {Repeat} | RepeatMode = {RepeatMode} | IntervalThrottle = {IntervalThrottle} | IntervalExecutionCount = {IntervalExecutionCount}";
return $"{this.GetType().Name} | Name = {Name} | Mode = {Mode} | Application = {Application} | Trigger = {Trigger} | Repeat = {Repeat} | RepeatMode = {RepeatMode} | IntervalThrottle = {IntervalThrottle} | IntervalExecutionCount = {IntervalExecutionCount} | InterruptsIdleTime = {InterruptsIdleTime}";
}
}
}
3 changes: 2 additions & 1 deletion 4x/Move Mouse/Actions/ClickMouseAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public double HoldInterval
public ClickMouseAction()
{
_button = MouseButton.Left;
InterruptsIdleTime = true;
}

public override bool CanExecute()
Expand Down Expand Up @@ -111,7 +112,7 @@ public override void Execute()

public override string ToString()
{
return $"{this.GetType().Name} | Name = {Name} | Button = {Button} | Hold = {Hold} | HoldInterval = {HoldInterval} | Trigger = {Trigger} | Repeat = {Repeat} | RepeatMode = {RepeatMode} | IntervalThrottle = {IntervalThrottle} | IntervalExecutionCount = {IntervalExecutionCount}";
return $"{this.GetType().Name} | Name = {Name} | Button = {Button} | Hold = {Hold} | HoldInterval = {HoldInterval} | Trigger = {Trigger} | Repeat = {Repeat} | RepeatMode = {RepeatMode} | IntervalThrottle = {IntervalThrottle} | IntervalExecutionCount = {IntervalExecutionCount} | InterruptsIdleTime = {InterruptsIdleTime}";
}
}
}
2 changes: 1 addition & 1 deletion 4x/Move Mouse/Actions/CommandAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public override void Execute()

public override string ToString()
{
return $"{this.GetType().Name} | Name = {Name} | FilePath = {FilePath} | Arguments = {Arguments} | WaitForExit = {WaitForExit} | Hidden = {Hidden} | Trigger = {Trigger} | Repeat = {Repeat} | RepeatMode = {RepeatMode} | IntervalThrottle = {IntervalThrottle} | IntervalExecutionCount = {IntervalExecutionCount}";
return $"{this.GetType().Name} | Name = {Name} | FilePath = {FilePath} | Arguments = {Arguments} | WaitForExit = {WaitForExit} | Hidden = {Hidden} | Trigger = {Trigger} | Repeat = {Repeat} | RepeatMode = {RepeatMode} | IntervalThrottle = {IntervalThrottle} | IntervalExecutionCount = {IntervalExecutionCount} | InterruptsIdleTime = {InterruptsIdleTime}";
}
}
}
3 changes: 2 additions & 1 deletion 4x/Move Mouse/Actions/MoveMouseCursorAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public MoveMouseCursorAction()
_distance = 10;
_direction = CursorDirection.Square;
Speed = CursorSpeed.Normal;
InterruptsIdleTime = true;
}

public override bool CanExecute()
Expand Down Expand Up @@ -237,7 +238,7 @@ public override void Execute()

public override string ToString()
{
return $"{this.GetType().Name} | Name = {Name} | Distance = {Distance} | Direction = {Direction} | Speed = {Speed} | Delay = {Delay} | Trigger = {Trigger} | Repeat = {Repeat} | RepeatMode = {RepeatMode} | IntervalThrottle = {IntervalThrottle} | IntervalExecutionCount = {IntervalExecutionCount}";
return $"{this.GetType().Name} | Name = {Name} | Distance = {Distance} | Direction = {Direction} | Speed = {Speed} | Delay = {Delay} | Trigger = {Trigger} | Repeat = {Repeat} | RepeatMode = {RepeatMode} | IntervalThrottle = {IntervalThrottle} | IntervalExecutionCount = {IntervalExecutionCount} | InterruptsIdleTime = {InterruptsIdleTime}";
}
}
}
2 changes: 1 addition & 1 deletion 4x/Move Mouse/Actions/PositionMouseCursorAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private void _cursorTrackingTimer_Elapsed(object sender, ElapsedEventArgs e)

public override string ToString()
{
return $"{this.GetType().Name} | Name = {Name} | X = {X} | Y = {Y} | Trigger = {Trigger} | Repeat = {Repeat} | RepeatMode = {RepeatMode} | IntervalThrottle = {IntervalThrottle} | IntervalExecutionCount = {IntervalExecutionCount}";
return $"{this.GetType().Name} | Name = {Name} | X = {X} | Y = {Y} | Trigger = {Trigger} | Repeat = {Repeat} | RepeatMode = {RepeatMode} | IntervalThrottle = {IntervalThrottle} | IntervalExecutionCount = {IntervalExecutionCount} | InterruptsIdleTime = {InterruptsIdleTime}";
}
}
}
2 changes: 1 addition & 1 deletion 4x/Move Mouse/Actions/ScriptAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public override void Execute()

public override string ToString()
{
return $"{this.GetType().Name} | Name = {Name} | ScriptPath = {ScriptPath} | WaitForExit = {WaitForExit} | Hidden = {Hidden} | Trigger = {Trigger} | Repeat = {Repeat} | RepeatMode = {RepeatMode} | IntervalThrottle = {IntervalThrottle} | IntervalExecutionCount = {IntervalExecutionCount}";
return $"{this.GetType().Name} | Name = {Name} | ScriptPath = {ScriptPath} | WaitForExit = {WaitForExit} | Hidden = {Hidden} | Trigger = {Trigger} | Repeat = {Repeat} | RepeatMode = {RepeatMode} | IntervalThrottle = {IntervalThrottle} | IntervalExecutionCount = {IntervalExecutionCount} | InterruptsIdleTime = {InterruptsIdleTime}";
}
}
}
3 changes: 2 additions & 1 deletion 4x/Move Mouse/Actions/ScrollMouseAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public ScrollMouseAction()
{
_distance = 100;
_direction = WheelDirection.Down;
InterruptsIdleTime = true;
}

public override bool CanExecute()
Expand Down Expand Up @@ -92,7 +93,7 @@ public override void Execute()

public override string ToString()
{
return $"{this.GetType().Name} | Name = {Name} | Distance = {Distance} | Direction = {Direction} | Trigger = {Trigger} | Repeat = {Repeat} | RepeatMode = {RepeatMode} | IntervalThrottle = {IntervalThrottle} | IntervalExecutionCount = {IntervalExecutionCount}";
return $"{this.GetType().Name} | Name = {Name} | Distance = {Distance} | Direction = {Direction} | Trigger = {Trigger} | Repeat = {Repeat} | RepeatMode = {RepeatMode} | IntervalThrottle = {IntervalThrottle} | IntervalExecutionCount = {IntervalExecutionCount} | InterruptsIdleTime = {InterruptsIdleTime}";
}
}
}
2 changes: 1 addition & 1 deletion 4x/Move Mouse/Actions/SleepAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public override void Execute()

public override string ToString()
{
return $"{this.GetType().Name} | Name = {Name} | Random = {Random} | Seconds = {Seconds} | UpperSeconds = {UpperSeconds} | Trigger = {Trigger} | Repeat = {Repeat} | RepeatMode = {RepeatMode} | IntervalThrottle = {IntervalThrottle} | IntervalExecutionCount = {IntervalExecutionCount}";
return $"{this.GetType().Name} | Name = {Name} | Random = {Random} | Seconds = {Seconds} | UpperSeconds = {UpperSeconds} | Trigger = {Trigger} | Repeat = {Repeat} | RepeatMode = {RepeatMode} | IntervalThrottle = {IntervalThrottle} | IntervalExecutionCount = {IntervalExecutionCount} | InterruptsIdleTime = {InterruptsIdleTime}";
}
}
}
4 changes: 2 additions & 2 deletions 4x/Move Mouse/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.16.2.0")]
[assembly: AssemblyFileVersion("4.16.2.0")]
[assembly: AssemblyVersion("4.16.3.0")]
[assembly: AssemblyFileVersion("4.16.3.0")]
19 changes: 12 additions & 7 deletions 4x/Move Mouse/ViewModels/MouseWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@
using ellabi.Jobs;
using ellabi.Schedules;
using ellabi.Utilities;
using ellabi.Wrappers;
using Microsoft.VisualBasic;
using Microsoft.Win32;
using Quartz;
using Quartz.Impl;
using Quartz.Impl.Triggers;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;

namespace ellabi.ViewModels
Expand Down Expand Up @@ -495,7 +493,7 @@ public void Start()
StopAutoResumeTimer();
_activeExecutionId = Guid.NewGuid();
_lastStopStartToggleTime = DateTime.Now;
PerformActions(ActionBase.EventTrigger.Start);
if (_firstPass) PerformActions(ActionBase.EventTrigger.Start);
double interval = SettingsVm.Settings.RandomInterval ? new Random().Next(SettingsVm.Settings.LowerInterval * 1000, SettingsVm.Settings.UpperInterval * 1000) : (SettingsVm.Settings.LowerInterval * 1000);
interval = interval > 0 ? interval : 1;
ExecutionTime = DateTime.Now.AddMilliseconds(interval);
Expand Down Expand Up @@ -642,6 +640,8 @@ private void PerformActions(ActionBase.EventTrigger trigger)
lock (_lock)
{
var executionId = _activeExecutionId;
var lastInputTime = StaticCode.GetLastInputTime();
IEnumerable<ActionBase> actions = null;

if (_firstPass)
{
Expand All @@ -658,7 +658,7 @@ private void PerformActions(ActionBase.EventTrigger trigger)
{
if (SettingsVm.Settings.Actions.Any(action => action.IsValid && action.IsEnabled && action.Trigger.Equals(trigger)))
{
var actions = SettingsVm.Settings.Actions.Where(action => action.IsValid && action.IsEnabled && action.Trigger.Equals(trigger));
actions = SettingsVm.Settings.Actions.Where(action => action.IsValid && action.IsEnabled && action.Trigger.Equals(trigger));

foreach (var action in actions)
{
Expand All @@ -681,7 +681,7 @@ private void PerformActions(ActionBase.EventTrigger trigger)

if (SettingsVm.Settings.Actions.Any(action => action.IsValid && action.IsEnabled && action.Trigger.Equals(trigger)))
{
var actions = _firstPass ? SettingsVm.Settings.Actions.Where(action => action.IsValid && action.IsEnabled && action.Trigger.Equals(trigger)) : SettingsVm.Settings.Actions.Where(action => action.IsValid && action.IsEnabled && action.Trigger.Equals(trigger) && action.Repeat && ((action.RepeatMode == ActionBase.IntervalRepeatMode.Forever) || ((action.RepeatMode == ActionBase.IntervalRepeatMode.Throttle) && (action.IntervalExecutionCount < action.IntervalThrottle))));
actions = _firstPass ? SettingsVm.Settings.Actions.Where(action => action.IsValid && action.IsEnabled && action.Trigger.Equals(trigger)) : SettingsVm.Settings.Actions.Where(action => action.IsValid && action.IsEnabled && action.Trigger.Equals(trigger) && action.Repeat && ((action.RepeatMode == ActionBase.IntervalRepeatMode.Forever) || ((action.RepeatMode == ActionBase.IntervalRepeatMode.Throttle) && (action.IntervalExecutionCount < action.IntervalThrottle))));

foreach (var action in actions)
{
Expand Down Expand Up @@ -718,7 +718,7 @@ private void PerformActions(ActionBase.EventTrigger trigger)
case ActionBase.EventTrigger.Stop:
if (SettingsVm.Settings.Actions.Any(action => action.IsValid && action.IsEnabled && action.Trigger.Equals(trigger)))
{
var actions = SettingsVm.Settings.Actions.Where(action => action.IsValid && action.IsEnabled && action.Trigger.Equals(trigger));
actions = SettingsVm.Settings.Actions.Where(action => action.IsValid && action.IsEnabled && action.Trigger.Equals(trigger));

foreach (var action in actions)
{
Expand All @@ -731,6 +731,11 @@ private void PerformActions(ActionBase.EventTrigger trigger)

break;
}

if ((actions != null) && actions.Any(action => action.InterruptsIdleTime) && (lastInputTime <= StaticCode.GetLastInputTime()))
{
StaticCode.Logger?.Here().Warning($"Your system idle time has not been reset which may result in session timeout due to lack of user activity. Please refer to the Troubleshooting section in the Wiki for further assistance ({StaticCode.TroubleshootingUrl}).");
}
}
}
catch (Exception ex)
Expand Down

0 comments on commit 8ec8136

Please sign in to comment.