baseline: OpenMU upstream b5a0961 (fresh source)

This commit is contained in:
Acentech Dev
2026-07-14 19:00:35 +03:00
parent 450402e47d
commit 36fc125d5c
11968 changed files with 748705 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
@page "/logfiles"
@using System.IO
@using MUnique.OpenMU.Web.AdminPanel.Properties
<PageTitle>OpenMU: @Resources.LogFiles</PageTitle>
<Breadcrumb IsFirstFromRoot="true" Caption="@Resources.LogFiles"/>
<div>
<table class="table table-striped table-hover">
<thead>
<tr>
<th>@Resources.FileName</th>
<th>@Resources.LastUpdate</th>
<th>@Resources.Size</th>
</tr>
</thead>
<tbody>
@foreach (var entry in this._files.OrderByDescending(f => f.LastWriteTime))
{
<tr>
<td>
<a href="logs/@entry.Name">@entry.Name</a>
</td>
<td>@entry.LastWriteTime</td>
<td>@FormatFileSize(entry.Length)</td>
</tr>
}
</tbody>
</table>
</div>
@code {
private readonly List<FileInfo> _files = new ();
/// <summary>
/// Initializes a new instance of class <see cref="LogFiles"/>.
/// </summary>
public LogFiles()
{
var files = Directory.GetFiles(Path.Combine(Directory.GetCurrentDirectory(), "logs"));
foreach (var filePath in files)
{
this._files.Add(new FileInfo(filePath));
}
}
private string FormatFileSize(long size)
{
return size switch
{
(< 1024 << 10) => $"{Math.Round(size / 1024D, 2)} KiB",
(< 1024 << 20) => $"{Math.Round(size * 1D / (1024 << 10), 2)} MiB",
(< 1024L << 30) => $"{Math.Round(size * 1D / (1024L << 20), 2)} GiB",
_ => $"{size} bytes"
};
}
}