Skip to content

Commit

Permalink
Merge pull request #9 from FrApp42/dev/main
Browse files Browse the repository at this point in the history
Dev/main
  • Loading branch information
sikelio authored Aug 25, 2024
2 parents b444ec1 + 62bda44 commit ffefe4e
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 43 deletions.
42 changes: 1 addition & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1 @@
# Website

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ pnpm install
```

### Local Development

```
$ pnpm run start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ pnpm run build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true pnpm run deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> pnpm run deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
# Frenchy Apps 42 website
16 changes: 16 additions & 0 deletions blog/2024-08-15-system/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
slug: system-v1.0.2
title: System v1.0.2
authors: [sikelio]
tags: [tools, system, csharp, releases]
---

## What's new ?

* Added awake class

## Changelog

You can read the changelog with the following link: [changelog](https://github.com/FrApp42/Tools/releases/tag/system-1.0.2).

You can also compare the changes with v1.0.0 with the following link: [changes](https://github.com/FrApp42/Tools/compare/1.0.1...system-1.0.2).
17 changes: 17 additions & 0 deletions blog/2024-08-24-web/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
slug: web-v1.1.0
title: Web v1.1.0
authors: [sikelio]
tags: [tools, web, csharp, releases]
---

## What's new ?

* Added tests
* Added `RunGetGytes()` in `Request` class

## Changelog

You can read the changelog with the following link: [changelog](https://github.com/FrApp42/Tools/releases/tag/web-1.1.0).

You can also compare the changes with v1.0.0 with the following link: [changes](https://github.com/FrApp42/Tools/compare/1.0.1...web-1.1.0).
8 changes: 8 additions & 0 deletions blog/tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,11 @@ vcards:
label: VCards
permalink: /vcards
description: Articles about VCards package
system:
label: System
permalink: /system
description: Articles about System package
web:
label: Web
permalink: /web
description: Articles about Web package
85 changes: 85 additions & 0 deletions docs/tools/system/system.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ 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)
Expand All @@ -25,6 +29,87 @@ Install-Package FrApp42.System

## Examples

### Avake

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

#### V1
#### Simple usage
```cs title="Program.cs"
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");
```

#### Log Awake error
```cs title="Program.cs"
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
```cs title="Program.cs"
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.

### IsOnline

* [AnthoDingo](https://github.com/AnthoDingo) - Author
Expand Down
24 changes: 22 additions & 2 deletions docs/tools/web/web.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ using FrApps42.Web.API;
string url = "";
HttpMethod method = HttpMethod.Get;

ApiRequest request = new(url, method);
Request request = new(url, method);
request
.AddContentHeader("", "")
.AddHeader("", "")
Expand Down Expand Up @@ -83,7 +83,7 @@ if (File.Exists(filePath))
{
byte[] fileBytes = File.ReadAllBytes(filePath);

ApiRequest request = new(url, HttpMethod.Post);
Request request = new(url, HttpMethod.Post);
request
.SetContentType("application/type")
.AddDocumentBody(fileBytes, "your_file_name.ext");
Expand Down Expand Up @@ -113,3 +113,23 @@ namespace Program
}
}
```

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

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

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

if (result.StatusCode == 200 && result.Value != null)
{
// Do something
}
else
{
// Other cases
}
```

0 comments on commit ffefe4e

Please sign in to comment.