Compare commits

...

17 Commits

Author SHA1 Message Date
e81f3261fb Add missing sources.
All checks were successful
Build and Deploy / build_and_deploy (push) Successful in 15m6s
2025-01-26 15:10:40 +03:00
b82f5dfe5e Fix everything.
Some checks failed
Build and Deploy / build_and_deploy (push) Failing after 3m5s
2025-01-26 15:01:58 +03:00
16de4424d0 Add nuget source for projects to compile.
Some checks failed
Build and Deploy / build_and_deploy (push) Failing after 3m14s
2025-01-25 20:13:39 +03:00
5936c41742 Update all packages.
Some checks failed
Build and Deploy / build_and_deploy (push) Failing after 3m4s
2025-01-25 20:07:18 +03:00
018ffbf1e6 Add missing \
Some checks failed
Build and Deploy / build_and_deploy (push) Failing after 2m32s
2025-01-25 19:56:48 +03:00
e09ecd496b YAML shenanigans.
Some checks failed
Build and Deploy / build_and_deploy (push) Failing after 9s
2025-01-25 19:55:35 +03:00
881b1bc02a Add more apt dependencies.
Some checks failed
Build and Deploy / build_and_deploy (push) Failing after 8s
2025-01-25 19:50:28 +03:00
b16c61773f Fix docfx call.
Some checks failed
Build and Deploy / build_and_deploy (push) Failing after 2m15s
2025-01-25 19:46:21 +03:00
6b446ffb29 More CI shenanigans.
Some checks failed
Build and Deploy / build_and_deploy (push) Failing after 33s
2025-01-25 19:44:43 +03:00
96f078f51e Mayhaps the package is called nodejs?
Some checks failed
Build and Deploy / build_and_deploy (push) Failing after 24s
2025-01-25 19:27:39 +03:00
386b07d1b8 Github CI is fun!
Some checks failed
Build and Deploy / build_and_deploy (push) Failing after 20s
2025-01-25 19:25:52 +03:00
9592f4f8e4 Update workflow.
Some checks failed
Build and Deploy / build_and_deploy (push) Failing after 8s
2025-01-25 19:22:39 +03:00
9a5ee6153e Create deploy.yaml
Some checks failed
Build and Deploy / build_and_deploy (push) Failing after 1m10s
2025-01-25 19:17:58 +03:00
32384be429 Add new pages. 2024-08-30 18:36:29 +03:00
8b7f3132b4 Add current projects. 2024-08-30 18:36:15 +03:00
2db1574b36 Update ReMime repository. 2024-08-30 17:44:48 +03:00
2fcf272f43 Removed ReFuel bindings documentation. 2024-08-30 17:41:55 +03:00
12 changed files with 262 additions and 12 deletions

View File

@@ -0,0 +1,66 @@
name: Build and Deploy
on:
push:
branches:
- master
workflow_dispatch:
jobs:
build_and_deploy:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/devcontainers/dotnet
steps:
- name: Install APT dependencies
run: |
apt update -y && apt install -y \
git \
nodejs \
libglib2.0-0 \
libnss3 \
libnspr4 \
libdbus-1-3 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libdrm2 \
libxcb1 \
libxkbcommon0 \
libx11-6 \
libxcomposite1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxrandr2 \
libgbm1 \
libpango-1.0-0 \
libcairo2 \
libasound2 \
libatspi2.0-0
- name: Install .NET Tools
run: dotnet tool update -g docfx
- name: Add NuGet Sources
run: |
dotnet nuget add source -n ReFuel -u ${{vars.NUGET_USER_NAME}} -p ${{secrets.REFUEL_API_KEY}} --store-password-in-clear-text ${{vars.NUGET_INDEX}}
dotnet nuget add source -n CallumDev -u ${{ vars.GH_USERNAME }} -p ${{ secrets.GH_API_KEY }} --store-password-in-clear-text https://nuget.pkg.github.com/CallumDev/index.json
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{secrets.REFUEL_API_KEY}}
- name: Compile Web Pages
run: $HOME/.dotnet/tools/docfx
- name: SFTP Deploy
uses: wlixcc/SFTP-Deploy-Action@v1.2.5
with:
username: '${{ vars.SSH_USER }}'
server: '${{ vars.SSH_SERVER }}'
port: '${{ vars.SSH_PORT }}'
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
local_path: './_site/*'
remote_path: '${{ vars.DESTINATION }}'
sftpArgs: -o ConnectTimeout=10
rsyncArgs: --exclude=.*
- name: Clear Secrets
run: |
dotnet nuget remove source ReFuel
dotnet nuget remove source CallumDev

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
_site
api
_site.{tar.gz, zip}

9
.gitmodules vendored
View File

@@ -4,6 +4,9 @@
[submodule "src/ReMime"]
path = src/ReMime
url = https://git.mixedup.dev/ReFuel/ReMime.git
[submodule "src/ReFuel.FreeType"]
path = src/ReFuel.FreeType
url = https://git.mixedup.dev/ReFuel/ReFuel.FreeType.git
[submodule "src/Dashboard"]
path = src/Dashboard
url = https://git.mixedup.dev/ReFuel/Dashboard.git
[submodule "src/ReFuel"]
path = src/ReFuel
url = https://git.mixedup.dev/ReFuel/ReFuel.git

View File

@@ -3,19 +3,49 @@
{
"src": [
{
"src": "src",
"src": "src/Dashboard",
"files": [
"**/*.csproj",
"**/bin/Release/*.dll"
"**/bin/Release/**.dll"
],
"exclude": [
"ReMime/ReMime.Tests/**"
"tests/**",
"lib/**"
]
},
{
"src": "src/ReFuel",
"files": [
"**/*.csproj",
"**/bin/Release/**.dll"
],
"exclude": [
"tests/**",
"lib/**"
]
},
{
"src": "src/ReFuel.StbImage",
"files": [
"**/*.csproj",
"**/bin/Release/**.dll"
]
},
{
"src": "src/ReMime",
"files": [
"**/*.csproj",
"**/bin/Release/**.dll"
],
"exclude":[
"ReMime.Tests/**",
"ReMime.ReFile/**"
]
}
],
"dest": "api",
"properties": {
"TargetFramework": "net6.0"
"TargetFramework": "net8.0"
}
}
],

57
docs/ReFile.md Normal file
View File

@@ -0,0 +1,57 @@
# ReFile Tool Guide
This is a very simple command that will consume files directories or stdin to resolve
its file types.
```
ReFile - Simple Tool demonstrating ReMime
ReMime Command Line Tool - Determine file Media Type
refile [-r] file/directory/-...
file infer a file
directory infer files in directory. Requires -r
- infer from standard input.
-r search files and folders recursively.
-a include hidden files.
-v verbose mode, use full paths.
--list list known mime types. Will ignore files.
--help show this help text.
```
### Listing Types
Use `refile --list` to list known media types.
```
$ refile --list | head
video/avi
audio/wav
image/vnd.microsoft.icon
image/webp
application/vnd.rar
application/postscript
application/pdf
audio/mp3
audio/flac
audio/midi
```
### Listing Files & Directories
Just pass the path strings into the command line. Use `-r` to recursively
traverse subdirectories. Here is an annotated command output:
```
# Lines beginning with # are comments.
# +--- Extension matched.
# |+-- Content matched.
# ||
# || File path Media Type
# || ----------------------------- ------------------------
-- toc.yml application/octet-stream
ec ../../../Downloads/image2.png image/png
e- _site.tar.gz application/gzip
e- index.md text/markdown
e- docfx.json application/json
# Skipping directory docs, set -r to traverse.
```

88
docs/ReMime.md Normal file
View File

@@ -0,0 +1,88 @@
# ReMime
ReMime is a simple IANA media types detector written in C#. It has it's own
detectors that can be used to detect common files, and it will query the OS
database if it exists.
## Simplest Usage Example
The namespace for the library is `ReMime`.
### Resolving Media Types
```cs
// Will resolve by file extensions.
MediaTypeResolver.TryResolve(pathString, out MediaType type); // returns bool.
MediaTypeResolver.TryResolve(fileInfo, out MediaType type, open: false); // returns MediaTypeResult
// Will resolve using content.
MediaTypeResolver.TryResolve(stream, out MediaType type); // returns bool.
MediaTypeResolver.TryResolve(byteSpan, out MediaType type); // returns bool.
// Will resolve using both file extensions and content.
MediaTypeResolver.TryResolve(pathString, stream, out MediaType type); // returns MediaTypeResult.
MediaTypeResolver.TryResolve(pathString, byteSpan, out MediaType type); // returns MediaTypeResult.
MediaTypeResolver.TryResolve(stream, out MediaType type); // returns bool.
MediaTypeResolver.TryResolve(byteSpan, out MediaType type); // returns bool.
MediaTypeResolver.TryResolve(fileInfo, out MediaType type, open: true); // returns MediaTypeResult
```
### `MediaTypeResult` Flags
| Value | Explaination |
|-------------|-----------------------------------------------------------------|
| `None` | Nothing matched if the value returned equals this. |
| `Extension` | Flag indicates the extension matched with the media type. |
| `Content` | Flag indicates the file content matched with the media type. |
## Adding Custom Resolvers
You will need to implement the interfaces `IMediaTypeResolver` or `IMediaContentResolver`.
The former will only resolve file extensions, whilst the latter will resolve with both file
extensions and its contents.
Then call `MediaTypeResolver.AddResolver()` with an instance of your custom resolver.
You can choose a resolution priority, by default the priority is 9999. ReMime resolver
priorities begin with 1000.
## Adding New Media Types to ReMime Resolvers
ReMime media type resolvers are singletons under `ReMime.ContentResolvers` and `ReMime.Platform`. Currently the following resolvers are extensible:
* `ReFuel.ContentResolvers.MagicContentResolver` (implements `IMagicValueResolver`)
* `ReFuel.ContentResolvers.RiffResolver` (implements `IMagicValueResolver`)
Classes that implement `IMagicValueResolver` have `AddMagicValue`/`AddMagicValues` methods
that make it easy to extend.
### `MagicValue`
A `MagicValue` is a simple class that tries to match a specific string of bytes. It can accept standard FourCC 32-bit integers, or a string with a simple syntax.
The string syntax expects hexadecimal values by default. The hexadecimal values given
must be byte aligned (no nibbles). Whitespace is ignored. You can start an ASCII sequence
using the single quote `'` character. The ASCII sequence accepts single character C
style escape sequences like `\'`.
### `MagicValueMediaType`
This is a simple record that the built-in resolvers use.
```cs
public record MagicValueMediaType(MediaType MediaType, MagicValue[] MagicValues, string[] Extensions);
```
Both arrays can be empty, as long as they are a non-null array. (See `Array.Empty<T>()`)
### Using a JSON File
ReMime includes a JSON serializer that makes it easy to configure the built-in resolvers.
The JSON serializer will ignore comments.
```jsonc
[
// List of media type entries.
{
"type": "image/png", // The media type key.
"magic": [ "89'PNG'" ], // List of magic value strings. (optional)
"extensions": [ "png" ] // List of file extensions strings excluding the leading dot. (also optional)
},
]
```
You may wish to include this database file as an embedded resource. Once you have the file
open, you can call `MagicValueDatabaseEntry.GetEntries(str)`. This will return a `List<MagicValueMediaType>` which can be consumed by the built-in resolvers using their `AddMagicValues` methods.

View File

@@ -1,2 +1,6 @@
- name: ReFuel.StbImage Guide
href: ReFuel.StbImage.md
- name: ReMime Guide
href: ReMime.md
- name: ReFile Tool Guide
href: ReFile.md

1
src/Dashboard Submodule

Submodule src/Dashboard added at 49257574f4

1
src/ReFuel Submodule

Submodule src/ReFuel added at 7de1910e9e