-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/Shared/Engine/Sucrose.Shared.Engine/Helper/Awakening.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using ESFLAGS = Skylark.Wing.Native.Methods.ES_FLAGS; | ||
using SMME = Sucrose.Manager.Manage.Engine; | ||
using SSWEW = Sucrose.Shared.Watchdog.Extension.Watch; | ||
using SWNM = Skylark.Wing.Native.Methods; | ||
using Timer = System.Timers.Timer; | ||
|
||
namespace Sucrose.Shared.Engine.Helper | ||
{ | ||
internal static class Awakening | ||
{ | ||
public static void Start() | ||
{ | ||
int Second = 30; | ||
|
||
Timer Awaker = new(Second * 1000); | ||
|
||
Awaker.Elapsed += async (s, e) => | ||
{ | ||
try | ||
{ | ||
if (SMME.StayAwake) | ||
{ | ||
SWNM.SetThreadExecutionState(ESFLAGS.ES_CONTINUOUS | ESFLAGS.ES_SYSTEM_REQUIRED | ESFLAGS.ES_DISPLAY_REQUIRED); | ||
} | ||
else | ||
{ | ||
SWNM.SetThreadExecutionState(ESFLAGS.ES_CONTINUOUS); | ||
} | ||
} | ||
catch (Exception Exception) | ||
{ | ||
await SSWEW.Watch_CatchException(Exception); | ||
} | ||
}; | ||
|
||
Awaker.AutoReset = true; | ||
|
||
Awaker.Start(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters