librius 0.5.1

A personal library manager CLI written in Rust.
Documentation
<#
.SYNOPSIS
    Checks whether an executable (.exe) contains embedded icon resources.

.DESCRIPTION
    Scans the specified executable for the presence of 'ICON' or 'RT_GROUP_ICON'
    ASCII markers, which indicate that one or more icons are embedded.

.PARAMETER Path
    The path to the executable file to inspect.

.EXAMPLE
    .\check_icon.ps1 -Path "target\release\rbackup.exe"
#>

param(
    [Parameter(Mandatory = $true)]
    [string]$Path
)

# Unicode emoji helpers
$OK = [char]0x2705  # ✅
$WARN = [char]0x26A0  # ⚠️
$FAIL = [char]0x274C  # ❌

if (-not (Test-Path $Path))
{
    Write-Host "$FAIL  Executable not found: $Path"
    exit 1
}

try
{
    # Read file as byte array (binary-safe)
    [byte[]]$bytes = [System.IO.File]::ReadAllBytes($Path)

    # Convert small portion to ASCII string for pattern search
    $content = [System.Text.Encoding]::ASCII.GetString($bytes)

    if ($content -match "ICON" -or $content -match "RT_GROUP_ICON")
    {
        Write-Host "$OK  Icon resource appears to be embedded in '$Path'"
        exit 0
    }
    else
    {
        Write-Host "$WARN  No icon resource found in '$Path'"
        Write-Host "     Possible causes: invalid .ico file, wrong resource ID, or missing .rc link."
        exit 1
    }
}
catch
{
    Write-Host "$FAIL  Error while reading '$Path': $_"
    exit 1
}