Skip to content

Commit

Permalink
Awake
Browse files Browse the repository at this point in the history
Import Powertoys Awake Module
  • Loading branch information
AnthoDingo committed Aug 15, 2024
1 parent e406a4a commit 337b665
Show file tree
Hide file tree
Showing 32 changed files with 1,300 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/gh-page.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Your GitHub workflow file under .github/workflows/
# Trigger the action on push to main
on:
push:
branches:
- main

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
actions: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
publish-docs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Dotnet Setup
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.x

- run: dotnet tool update -g docfx
- run: docfx Docs/docfx.json

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: 'Docs/_site'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -421,3 +421,6 @@ $RECYCLE.BIN/

# Windows shortcuts
*.lnk

*/_site
*/api*
59 changes: 59 additions & 0 deletions Docs/docfx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"metadata": [
{
"src": [
{
"src": "../System",
"files": [
"**/*.csproj"
]
}
],
"dest": "api.System"
},
{
"src": [
{
"src": "../Web",
"files": [
"**/*.csproj"
]
}

],
"dest": "api.Web"
}
],
"build": {
"content": [
{
"files": [
"**/*.{md,yml}"
],
"exclude": [
"_site/**"
]
}
],
"resource": [
{
"files": [
"images/**"
]
}
],
"output": "_site",
"template": [
"default",
"modern",
"templates/material"
],
"globalMetadata": {
"_appName": "Tools",
"_appTitle": "Tools",
"_appLogoPath": "images/logo.png",
"_enableSearch": true,
"pdf": false
}
}
}
92 changes: 92 additions & 0 deletions Docs/docs/Awake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Awake

Module is exported from Microsoft Powertoys under license MIT.

>[!NOTE]
>Works only for Windows host

## V1

Simple usage

```C#
using FrApps42.System.Computer.Awake.v1;
...

// Keep Screen on
Awake..SetIndefiniteKeepAwake(true);
// Keep Screen off
Awake..SetIndefiniteKeepAwake(false);

// Disable Keep Awake
Awake.SetNoKeepAwake();

...

Awake.CompleteExit(0, false, "AppName");

```

If you want to log Awake error

```C#
using FrApps42.System.Computer.Awake.v1;
...

private static void LogUnexpectedOrCancelledKeepAwakeThreadCompletion(){
Console.WriteLine("The keep-awake thread was terminated early.");
}

private static void LogCompletedKeepAwakeThread(bool result)
{
Console.WriteLine($"Exited keep-awake thread successfully: {result}");
}

// Keep Screen on
Awake..SetIndefiniteKeepAwake(LogCompletedKeepAwakeThread, LogUnexpectedOrCancelledKeepAwakeThreadCompletion,true);
// Keep Screen off
Awake..SetIndefiniteKeepAwake(LogCompletedKeepAwakeThread, LogUnexpectedOrCancelledKeepAwakeThreadCompletion,false);

// Disable Keep Awake
Awake.SetNoKeepAwake();

...

Awake.CompleteExit(0, false, "AppName");

```

## V2

Updated version of Power Awake

```C#
using FrApps42.System.Computer.Awake.v1;
...

private static void LogUnexpectedOrCancelledKeepAwakeThreadCompletion(){
Console.WriteLine("The keep-awake thread was terminated early.");
}

private static void LogCompletedKeepAwakeThread(bool result)
{
Console.WriteLine($"Exited keep-awake thread successfully: {result}");
}

// Keep Screen on
Awake..SetIndefiniteKeepAwake(true);
// Keep Screen off
Awake..SetIndefiniteKeepAwake(false);

// Keep Awake for a specified seconds with screen on
Awake.SetTimedKeepAwake(3600, true);
// Keep Awake for a specified seconds with screen off
Awake.SetTimedKeepAwake(3600, false);

// Disable Keep Awake
Awake.SetNoKeepAwake();

```

In V2, be sure to disable KeepAwake before app closing.
16 changes: 16 additions & 0 deletions Docs/docs/Net.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# NET

>[!NOTE]
> Tested on Windows, should works on Linux and MacOS
## IsOnline

Simple class to test if computer is Online.

```C#
using FrApps42.System.Net;`


bool result = (new IsOnline("8.8.8.8")).Check();

```
6 changes: 6 additions & 0 deletions Docs/docs/Shutdown.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Shutdown

>[!NOTE]
>Works only for Windows host
Simple lib to shutdown local or remote Windows computer
5 changes: 5 additions & 0 deletions Docs/docs/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Introduction

Available Namespace :
- System
- Web
8 changes: 8 additions & 0 deletions Docs/docs/toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- name: Introduction
href: introduction.md
- name: Shutdown
href: Shutdown.md
- name: Awake
href: Awake.md
- name: Net
href: Net.md
Binary file added Docs/images/Logo Inversed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Docs/images/logo.github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Docs/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions Docs/images/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions Docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
_layout: landing
---

<meta http-equiv="refresh" content="0; url=docs/introduction.html" />
Loading

0 comments on commit 337b665

Please sign in to comment.