summary refs log tree commit diff
path: root/Rhea/Program.cs
blob: 3d12b0237043b3b67057c180612865f86a8c3d74 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System.Diagnostics;
using System.Reflection;
using System.Text;
using ArcaneLibs;
using ArcaneLibs.Extensions;
using Rhea;
using Rhea.Nar;


// new NarWriter().GetHeader().ToArray().HexDump(64);

foreach (var fieldInfo in typeof(NarConsts).GetFields())
{
    // Console.WriteLine(fieldInfo);
    var rawBytes = (byte[])fieldInfo.GetValue(null)!;
    var sizeBytes = rawBytes[..8];
    var dataBytes = rawBytes[8..];
    Console.WriteLine(
        $$"""
          public static readonly byte[] {{fieldInfo.Name}} = new byte[] {
              {{string.Join(", ", sizeBytes.Select(x => x.ToString()))}}, // {{dataBytes.Trim((byte)0).ToArray().Length}} bytes
              {{string.Join(", ", dataBytes.Select(x => x.ToString()))}}, // "{{Encoding.UTF8.GetString(dataBytes)}}"u8 + padding
              {{string.Join(", ", rawBytes.Select(x => x.ToString()))}}
          };
          """
    );
}

return;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers();
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
builder.Services.AddOpenApi();
builder.Services.AddSingleton<RheaConfiguration>();
builder.Services.AddSingleton<StoreMetaService>();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.MapOpenApi();
}

app.UseAuthorization();

app.MapControllers();

// app.Run();