Skip to content

Commit c1c4bf6

Browse files
committed
Restore timer logic
1 parent 47d44e9 commit c1c4bf6

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Logic/OSCTimer.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ public static void Setup()
154154
VRChatConnector.ModifyEndPoint(true, absolute_max_parameter, "b", Attributes.AccessValues.ReadOnly, "OSCLock Absolute Max Param");
155155
}
156156

157+
ResetParameters();
158+
157159
_timer = new Timer();
158160

159161
var callbackInterval = timerConfig.readout_interval;
@@ -186,8 +188,18 @@ public static void Setup()
186188

187189
AbsoluteEndTime = StartTime.AddMinutes(absolute_max);
188190
EarlietEndTime = StartTime.AddMinutes(absolute_min);
189-
Program.isAllowedToUnlock = false;
190-
_timer.Start();
191+
192+
if (EndTime < DateTime.Now)
193+
{
194+
ColorConsole.WithYellowText.WriteLine("Previous timer has ended, resetting values.\n");
195+
Program.isAllowedToUnlock = true;
196+
}
197+
else
198+
{
199+
ColorConsole.WithGreenText.WriteLine("Previous timer restored.\n");
200+
Program.isAllowedToUnlock = false;
201+
_timer.Start();
202+
}
191203
}
192204
catch (Exception e)
193205
{

0 commit comments

Comments
 (0)