Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
push:
branches:
- main
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on

jobs:
build:
Expand All @@ -15,15 +13,20 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
cache: pnpm

- name: Install dependencies
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile

- name: Build website
run: yarn build
run: pnpm run build

- name: Upload Build Artifact
uses: actions/upload-pages-artifact@v3
Expand All @@ -34,12 +37,10 @@ jobs:
name: Deploy to GitHub Pages
needs: build

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
pages: write
id-token: write

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/test-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
pull_request:
branches:
- main
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on

jobs:
test-deploy:
Expand All @@ -15,12 +13,17 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
cache: pnpm

- name: Install dependencies
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile

- name: Test build website
run: yarn build
run: pnpm run build
81 changes: 61 additions & 20 deletions docs/tools/system/system.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,22 @@ sidebar_label: 'System'

Collection of classes in C# helping you to execute system operations.

Content:
* [Avake](#avake)
* [Simple usage](#simple-usage)
* [Log Awake error](#log-awake-error)
* [Updated version of Power Awake](#updated-version-of-power-awake)
* [IsOnline](#isonline)
* [Check if device is online](#check-if-device-is-online)
* [Shutdown](#shutdown-windows-only)
* [Shutdown a specific computer](#shutdown-a-specific-computer)
* [Ping before shutdown](#ping-before-shutdown)
* [Log off the current user](#log-off-the-current-user)
* [Shutdown and sign on automatically](#shutdown-and-sign-on-automatically)
* [Set a timeout and add a custom reason for the shutdown](#set-a-timeout-and-add-a-custom-reason-for-the-shutdown)
* [WakeOnLan](#wakeonlan)
## Content
* [Installation](#installation)
* [Examples](#examples)
* [Avake](#avake)
* [Simple usage](#simple-usage)
* [Log Awake error](#log-awake-error)
* [Updated version of Power Awake](#updated-version-of-power-awake)
* [IsOnline](#isonline)
* [Check if device is online](#check-if-device-is-online)
* [Shutdown](#shutdown-windows-only)
* [Shutdown a specific computer](#shutdown-a-specific-computer)
* [Ping before shutdown](#ping-before-shutdown)
* [Log off the current user](#log-off-the-current-user)
* [Shutdown and sign on automatically](#shutdown-and-sign-on-automatically)
* [Set a timeout and add a custom reason for the shutdown](#set-a-timeout-and-add-a-custom-reason-for-the-shutdown)
* [WakeOnLan](#wakeonlan)

## Installation

Expand All @@ -31,18 +33,29 @@ Install-Package FrApp42.System

### Avake

Authors / Contributors:
* [AnthoDingo](https://github.com/AnthoDingo) - Author (taken from PowerToys)

---

This class allows you to hanfle the awake on machines.

:::warning
This only works on Windows.
:::

---

#### V1
#### Simple usage
```cs title="Program.cs"
using FrApps42.System.Computer.Awake.v1;
...

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

// Disable Keep Awake
Awake.SetNoKeepAwake();
Expand Down Expand Up @@ -80,6 +93,11 @@ Awake.CompleteExit(0, false, "AppName");
```

#### V2

:::info
In V2, be sure to disable KeepAwake before app closing.
:::

#### Updated version of Power Awake
```cs title="Program.cs"
using FrApps42.System.Computer.Awake.v1;
Expand All @@ -95,9 +113,9 @@ private static void LogCompletedKeepAwakeThread(bool result)
}

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

// Keep Awake for a specified seconds with screen on
Awake.SetTimedKeepAwake(3600, true);
Expand All @@ -108,12 +126,17 @@ Awake.SetTimedKeepAwake(3600, false);
Awake.SetNoKeepAwake();
```

In V2, be sure to disable KeepAwake before app closing.

### IsOnline

Authors / Contributors:
* [AnthoDingo](https://github.com/AnthoDingo) - Author

---

This allows you to check if a machine is online with a ping.

---

#### Check if device is online

```csharp title="Program.cs"
Expand All @@ -129,9 +152,20 @@ bool isOnline = online.Check();

### Shutdown (Windows-only)

Authors / Contributors:
* [Sikelio](https://github.com/sikelio) - Author
* [AnthoDingo](https://github.com/AnthoDingo) - Contributor

---

This class allow you to shutdown remotly Windows machines.

:::warning
This only work on Windows machines.
:::

---

#### Shutdown a specific computer

```csharp title="Program.cs"
Expand Down Expand Up @@ -245,9 +279,16 @@ else

### WakeOnLan

Authors / Contributors:
* [Poul Bak](https://stackoverflow.com/users/5741643/poul-bak) - Original author
* [Sikelio](https://github.com/sikelio) - Contributor

---

This class allows you to use WOL to power on machine of their MAC address.

---

```csharp title="Program.cs"
using FrApp42.System.Net;

Expand Down
79 changes: 67 additions & 12 deletions docs/tools/web/web.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ sidebar_label: 'Web'

Collection of classes in C# helping you to execute web operations.

Content:
* [Request](#request)
* [Simple request](#simple-request)
* [Sending binary file](#sending-binary-file)
## Content
* [Installation](#installation)
* [Examples](#examples)
* [Request](#request)
* [Simple request](#simple-request)
* [Sending binary file](#sending-binary-file)
* [Sending raw file](#sending-raw-file)
* [Getting binary file in response](#getting-binary-file-in-response)

## Installation

Expand All @@ -19,15 +23,31 @@ Install-Package FrApp42.Web

## Examples

### Request

Authors / Contributors:
* [AnthoDingo](https://github.com/AnthoDingo) - Author (inspiration taken from the community)
* [Sikelio](https://github.com/sikelio) - Contributor

### Request
---

This class allows you to simplify HTTP requests.

:::info
You'll need `Newtosoft.Json` [**13.0.3+**](https://www.nuget.org/packages/Newtonsoft.Json/13.0.3) nuget package to use the `Request` class.

```nuget
Install-Package Newtosoft.Json
```
:::

---

#### Simple request

```cs title="Program.cs"
using FrApps42.Web.API;
using System.Net;

string url = "";
HttpMethod method = HttpMethod.Get;
Expand All @@ -42,7 +62,7 @@ request

Result<MyModel> result = await request.RunObject<MyModel>();

if (result.StatusCode == 200 && result.Value != null)
if (result.StatusCode == (int)HttpStatusCode.OK && result.Value != null)
{
Console.WriteLine(result.Value.Name);
Console.WriteLine(result.Value.Description);
Expand All @@ -54,16 +74,16 @@ else
```

```cs title="MyModel.cs"
using System.Text.Json.Serialization;
using Newtonsoft.Json;

namespace Program
{
public class MyModel
{
[JsonPropertyName("name")]
[JsonProperty("name")]
public string Name { get; set; }

[JsonPropertyName("description")]
[JsonProperty("description")]
public string Description { get; set; }
}
}
Expand All @@ -73,6 +93,7 @@ namespace Program

```cs title="Program.cs"
using FrApps42.Web.API;
using System.IO;

string url = "";
string filePath = "path_to_your_file.ext";
Expand Down Expand Up @@ -102,29 +123,63 @@ else
```

```cs title="MyModel.cs"
using System.Text.Json.Serialization;
using Newtonsoft.Json;

namespace Program
{
public class MyModel
{
[JsonPropertyName("success")]
[JsonProperty("success")]
public bool Success { get; set; }
}
}
```

#### Sending raw file

```cs title="Program.cs"
using FrApps42.Web.API;
using System.IO;

string url = "";
string filePath = "path_to_your_file.ext";

if (File.Exists(filePath))
{
try
{
byte[] fileBytes = File.ReadAllBytes(filePath);

Request request = new(url, HttpMethod.Post);
request
.SetContentType("text/plain")
.AddDocumentBody(fileBytes, null);

Result<object> result = await request.RunBinaryRaw<object>();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
else
{
Console.WriteLine("File do not exist");
}
```

#### Getting binary file in response
```cs title="Program.cs"
using FrApps42.Web.API;
using System.Net;

string url = "";
HttpMethod method = HttpMethod.Get;

Request request = new(url, method);
Result<byte[]> result = await request.RunGetBytes();

if (result.StatusCode == 200 && result.Value != null)
if (result.StatusCode == (int)HttpStatusCode.OK && result.Value != null)
{
// Do something
}
Expand Down
1 change: 1 addition & 0 deletions docs/v-cards/v-cards.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ sidebar_position: 3

# VCards

Authors / Contributors:
* Based on project [MixERP.Net.VCards](https://github.com/mixerp/MixERP.Net.VCards)
* [AnthoDingo](http://github.com/AnthoDingo) - Contributor

Expand Down
Loading